Package org.xtreemfs.foundation.buffer

Examples of org.xtreemfs.foundation.buffer.ReusableBuffer.remaining()


       
        int start = random.nextInt((int) (maxTestFileSize - minChunkSize));
        int end = random.nextInt((int) (maxTestFileSize - minChunkSize - start))
                        + minChunkSize + start;
        ReusableBuffer result = client.chunk(testFileName, start, end).get();
        assertEquals(end - start, result.remaining());
       
        byte[] testData = new byte[end - start];
        FileInputStream sIn = new FileInputStream(testFileName);
        sIn.skip(start);
        sIn.read(testData, 0, end - start);
View Full Code Here


                        assert (le.getPayload().array().length > 0) :
                            "Empty log-entries are not allowed!";
                        ReusableBuffer buf = le.serialize(checksum);
                        result.addLogEntries(
                                org.xtreemfs.babudb.pbrpc.GlobalTypes.LogEntry
                                .newBuilder().setLength(buf.remaining()));
                        int newSize = resultPayLoad.remaining() +
                                      buf.remaining();
                        if (!resultPayLoad.enlarge(newSize)) {
                            ReusableBuffer tmp = BufferPool.allocate(newSize);
                           
View Full Code Here

                        ReusableBuffer buf = le.serialize(checksum);
                        result.addLogEntries(
                                org.xtreemfs.babudb.pbrpc.GlobalTypes.LogEntry
                                .newBuilder().setLength(buf.remaining()));
                        int newSize = resultPayLoad.remaining() +
                                      buf.remaining();
                        if (!resultPayLoad.enlarge(newSize)) {
                            ReusableBuffer tmp = BufferPool.allocate(newSize);
                           
                            tmp.put(resultPayLoad);
                            BufferPool.free(resultPayLoad);
View Full Code Here

                       
                    Logging.logMessage(Logging.LEVEL_DEBUG, this,
                            "Writing entry LSN(%d:%d) with %d bytes payload [%s] to log. " +
                            "[serialized %d bytes]", viewID, seqNo,
                            le.getPayload().remaining(), new String(le.getPayload().array()),
                            buffer.remaining());
                   
                    // write the LogEntry to the local disk
                    channel.write(buffer.getBuffer());
                   
                } finally {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.