Package org.activeio.packet

Examples of org.activeio.packet.ByteBufferPacket


    private void appendHelloRecord(int i) throws IOException, InterruptedException {
        byte data[] = ("Hello World: " + i).getBytes();
        Record batchedRecord = new Record(LogFileManager.DATA_RECORD_TYPE, new ByteArrayPacket(data), null);
        batchedRecord.setLocation(logFile.getNextAppendLocation());
       
        BatchedWrite write = new BatchedWrite(new ByteBufferPacket(ByteBuffer.allocate(1024)));
        write.append(batchedRecord,null, true);
        write.flip();
        logFile.append(write);
    }
View Full Code Here


        IAsyncFuture future = (IAsyncFuture)abstractFuture;
        try {
           
            if( inputByteBuffer.position()>0 ) {
              ByteBuffer remaining = inputByteBuffer.slice();           
              Packet data = new ByteBufferPacket(((ByteBuffer)inputByteBuffer.flip()).slice());
             
              channelListener.onPacket(data);             
              // Keep the remaining buffer around to fill with data.
              inputByteBuffer = remaining;
              requestNextRead();
View Full Code Here

                if( size2 > 0 )
                    size += size2;
              }
             
              ByteBuffer remaining = inputByteBuffer.slice();           
              Packet data = new ByteBufferPacket(((ByteBuffer)inputByteBuffer.flip()).slice());
              this.channelListener.onPacket( data );
                         
              // Keep the remaining buffer around to fill with data.
              inputByteBuffer = remaining;
             
View Full Code Here

    public ControlFile(File fileName, int controlDataSize) throws IOException {

        boolean existed = fileName.exists();       
        file = new RandomAccessFile(fileName, "rw");
        channel = file.getChannel();
        controlData = new ByteBufferPacket(ByteBuffer.allocateDirect(controlDataSize));

    }
View Full Code Here

                return EOSPacket.EOS_PACKET;
            if( size == 0 )
                return EmptyPacket.EMPTY_PACKET;

            ByteBuffer remaining = inputByteBuffer.slice();           
            Packet data = new ByteBufferPacket(((ByteBuffer)inputByteBuffer.flip()).slice());
           
            // Keep the remaining buffer around to fill with data.
            inputByteBuffer = remaining;
            return data;
           
View Full Code Here

TOP

Related Classes of org.activeio.packet.ByteBufferPacket

Copyright © 2018 www.massapicom. 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.