Package java.nio

Examples of java.nio.ByteBuffer.rewind()


                       Iterator<AvroValue<ByteBuffer>> iterator,
                       OutputCollector<Text, Text> collector,
                       Reporter reporter) throws IOException {

        ByteBuffer keyBuffer = keyAvro.datum();
        keyBuffer.rewind();

        byte[] keyBytes = null, valueBytes;

        keyBytes = new byte[keyBuffer.remaining()];
        keyBuffer.get(keyBytes);
View Full Code Here


        ArrayList<BytesWritable> valueList = new ArrayList();

        while(iterator.hasNext()) {
            ByteBuffer writable = iterator.next().datum();
            writable.rewind();
            // BytesWritable writable = iterator.next();
            valueBytes = null;
            valueBytes = new byte[writable.remaining()];
            writable.get(valueBytes);
View Full Code Here

      HornetQBuffer buffer = HornetQBuffers.wrappedBuffer(bb);

      JournalImpl.writeHeader(buffer, userVersion, fileID);

      bb.rewind();

      int bufferSize = bb.limit();

      sequentialFile.position(0);
View Full Code Here

                       Iterator<AvroValue<ByteBuffer>> iterator,
                       OutputCollector<Text, Text> collector,
                       Reporter reporter) throws IOException {

        ByteBuffer keyBuffer = keyAvro.datum();
        keyBuffer.rewind();

        byte[] keyBytes = null, valueBytes;

        keyBytes = new byte[keyBuffer.remaining()];
        keyBuffer.get(keyBytes);
View Full Code Here

        ArrayList<BytesWritable> valueList = new ArrayList();

        while(iterator.hasNext()) {
            ByteBuffer writable = iterator.next().datum();
            writable.rewind();
            // BytesWritable writable = iterator.next();
            valueBytes = null;
            valueBytes = new byte[writable.remaining()];
            writable.get(valueBytes);
View Full Code Here

        // TODO make this configurable
        ByteBuffer buffer = ByteBuffer.allocate(8192);
        int read;

        while ((read = inChannel.read(buffer)) > 0) {
            buffer.rewind();
            buffer.limit(read);

            while (read > 0) {
                read -= outChannel.write(buffer);
            }
View Full Code Here

                }

                buffer.put(0, c);

                buffer.rewind();
                byteBuffer.rewind();
                encoder.encode(buffer, byteBuffer, true);

                byteBuffer.flip();

                int limit = byteBuffer.limit();
View Full Code Here

                    else {
                        sock.receive(packet);
                        msg_data=packet.getData();
                    }

                    rb.rewind();
                    rb.put(msg_data);
                    rb.rewind();
                    number=rb.getInt();

                    matrix[number][1]=1;
View Full Code Here

                        msg_data=packet.getData();
                    }

                    rb.rewind();
                    rb.put(msg_data);
                    rb.rewind();
                    number=rb.getInt();

                    matrix[number][1]=1;
                    // System.out.println("#set " + number);
                    num_received++;
View Full Code Here

            }
        }

        out.limit(out.position());
        out.rewind();
        return out;
    }

    /**
     * @see
 
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.