Package org.xtreemfs.foundation.buffer

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


        ReplicationClientAdapter testClient = new ReplicationClientAdapter(client,
                config.getInetSocketAddress());
       
        // run some test operations
        ReusableBuffer result = testClient.chunk(fileName, offsetStart, offsetEnd).get();
        assertEquals(chunkResult, new String(result.array()));
       
        testClient.heartbeat(lsn, port).get();
    }
   
    /**
 
View Full Code Here


    @Override
    public void processRequest(final Request rq) {
       
        Lookup req = (Lookup) rq.getRequestMessage();
        ReusableBuffer data = rq.getData();
        byte[] key = (data != null) ? data.array() : null;
       
        Logging.logMessage(Logging.LEVEL_DEBUG, this, "PrefixLookupReverseOperation:" +
                "db %s, index %d, key %s.", req.getDatabaseName(), req.getIndexId(),
                (key == null) ? "null" : new String(key));
       
View Full Code Here

    @Override
    public void processRequest(final Request rq) {
       
        Lookup req = (Lookup) rq.getRequestMessage();
        ReusableBuffer data = rq.getData();
        byte[] key = (data != null) ? data.array() : null;
       
        Logging.logMessage(Logging.LEVEL_DEBUG, this, "PrefixLookupOperation:" +
                "db %s, index %d, key %s.", req.getDatabaseName(), req.getIndexId(),
                (key == null) ? "null" : new String(key));
       
View Full Code Here

        FileInputStream sIn = new FileInputStream(testFileName);
        sIn.skip(start);
        sIn.read(testData, 0, end - start);
        sIn.close();
       
        assertEquals(new String(testData), new String(result.array()));
       
        // clean up
        BufferPool.free(result);
    }
   
View Full Code Here

                ReusableBuffer buf = ReusableBuffer.wrap(new byte[(Integer.SIZE / 8) + (Short.SIZE / 8)]);
                buf.putInt(blockOffset);
                buf.putShort(blockFileId);
               
                // add the key-offset mapping to the block index
                blockIndex.add(InternalBufferUtil.toBuffer(block.getBlockKey()), buf.array());
               
                // serialize the block and calculate the next block offset
                SerializedBlock serializedBlock = block.serialize();
                blockOffset += serializedBlock.size();
               
View Full Code Here

       
        buf.position(offset);
        buf.limit(limit);
        ReusableBuffer newBuf = BufferPool.allocate(limit - buf.position());
        newBuf.put(buf);
        String result = OutputUtils.byteArrayToFormattedHexString(newBuf.array());
        BufferPool.free(newBuf);
        buf.clear();
       
        return result;
    }
View Full Code Here

       
        buf.position(offset);
        buf.limit(offsetListStart + numEntries * Integer.SIZE / 8);
        ReusableBuffer newBuf = BufferPool.allocate(buf.limit() - buf.position());
        newBuf.put(buf);
        String result = OutputUtils.byteArrayToFormattedHexString(newBuf.array());
        BufferPool.free(newBuf);
        buf.clear();
       
        return result;
    }
View Full Code Here

            // reset the old checksum to 0, before calculating a new one
            buf.position(Integer.SIZE / 8);
            buf.putInt(0);
            buf.position(0);
           
            csumAlgo.update(buf.array(), 0, buf.limit());
            int cPos = buf.position();
           
            // write the checksum to the buffer
            buf.position(Integer.SIZE / 8);
            buf.putInt((int) csumAlgo.getValue());
View Full Code Here

    public String toString() {
        // return buf.toString() + " [" + startOffset + ", " + endOffset + ")";
        ReusableBuffer buffer = new ReusableBuffer(buf);
        ReusableBuffer newBuf = buffer.createViewBuffer();
        newBuf.range(startOffset, endOffset - startOffset);
        return OutputUtils.byteArrayToHexString(newBuf.array());
    }
   
}
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.