Examples of ByteBufferArray


Examples of org.apache.hadoop.hbase.util.ByteBufferArray

   * @param direct true if allocate direct buffer
   * @throws IOException
   */
  public ByteBufferIOEngine(long capacity, boolean direct)
      throws IOException {
    bufferArray = new ByteBufferArray(capacity, direct);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.util.ByteBufferArray

   */
  public ByteBufferIOEngine(long capacity, boolean direct)
      throws IOException {
    this.capacity = capacity;
    this.direct = direct;
    bufferArray = new ByteBufferArray(capacity, direct);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.util.ByteBufferArray

   */
  public ByteBufferIOEngine(long capacity, boolean direct)
      throws IOException {
    this.capacity = capacity;
    this.direct = direct;
    bufferArray = new ByteBufferArray(capacity, direct);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.util.ByteBufferArray

   * @param direct true if allocate direct buffer
   * @throws IOException
   */
  public ByteBufferIOEngine(long capacity, boolean direct)
      throws IOException {
    bufferArray = new ByteBufferArray(capacity, direct);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.util.ByteBufferArray

   */
  public ByteBufferIOEngine(long capacity, boolean direct)
      throws IOException {
    this.capacity = capacity;
    this.direct = direct;
    bufferArray = new ByteBufferArray(capacity, direct);
  }
View Full Code Here

Examples of org.glassfish.grizzly.memory.ByteBufferArray

            final ReadHandler readHandler = tyrusConnection.getReadHandler();
            TaskProcessor taskProcessor = getTaskProcessor(ctx);
            if (!buffer.isComposite()) {
                taskProcessor.processTask(new ProcessTask(buffer.toByteBuffer(), readHandler));
            } else {
                final ByteBufferArray byteBufferArray = buffer.toByteBufferArray();
                final ByteBuffer[] array = byteBufferArray.getArray();

                for (int i = 0; i < byteBufferArray.size(); i++) {
                    taskProcessor.processTask(new ProcessTask(array[i], readHandler));
                }

                byteBufferArray.recycle();
            }
        }
        return ctx.getStopAction();
    }
View Full Code Here

Examples of org.glassfish.grizzly.memory.ByteBufferArray

            message.recycle();
            final ReadHandler readHandler = tyrusConnection.getReadHandler();
            if (!buffer.isComposite()) {
                taskQueue.add(new ProcessTask(buffer.toByteBuffer(), readHandler));
            } else {
                final ByteBufferArray byteBufferArray = buffer.toByteBufferArray();
                final ByteBuffer[] array = byteBufferArray.getArray();

                for (int i = 0; i < byteBufferArray.size(); i++) {
                    taskQueue.add(new ProcessTask(array[i], readHandler));
                }

                byteBufferArray.recycle();
            }

            TaskProcessor.processQueue(taskQueue, null);
        }
        return ctx.getStopAction();
View Full Code Here

Examples of org.glassfish.grizzly.memory.ByteBufferArray

        final int read;

        final int oldPos = buffer.position();

        if (buffer.isComposite()) {
            final ByteBufferArray array = buffer.toByteBufferArray();
            final ByteBuffer[] byteBuffers = array.getArray();
            final int size = array.size();

            read = (int) ((DatagramChannel) connection.getChannel()).read(byteBuffers, 0, size);

            array.restore();
            array.recycle();
        } else {
            read = ((DatagramChannel) connection.getChannel()).read(
                    buffer.toByteBuffer());
        }
View Full Code Here

Examples of org.glassfish.grizzly.memory.ByteBufferArray

                written = ((DatagramChannel) connection.getChannel()).send(
                        buffer.toByteBuffer(), dstAddress);
            } else {

                if (buffer.isComposite()) {
                    final ByteBufferArray array = buffer.toByteBufferArray();
                    final ByteBuffer[] byteBuffers = array.getArray();
                    final int size = array.size();

                    written = ((DatagramChannel) connection.getChannel()).write(byteBuffers, 0, size);

                    array.restore();
                    array.recycle();
                } else {
                    written = ((DatagramChannel) connection.getChannel()).write(
                            buffer.toByteBuffer());
                }
            }
View Full Code Here

Examples of org.glassfish.grizzly.memory.ByteBufferArray

    public static int readCompositeBuffer(final TCPNIOConnection connection,
            final CompositeBuffer buffer) throws IOException {
       
        final SocketChannel socketChannel = (SocketChannel) connection.getChannel();
        final int oldPos = buffer.position();
        final ByteBufferArray array = buffer.toByteBufferArray();
        final ByteBuffer byteBuffers[] = array.getArray();
        final int size = array.size();
       
        final int read = (int) socketChannel.read(byteBuffers, 0, size);

        array.restore();
        array.recycle();
       
        if (read > 0) {
            buffer.position(oldPos + read);
        }
       
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.