org.apache.http.nio.util

## Class DirectByteBufferAllocator

- java.lang.Object
- - org.apache.http.nio.util.DirectByteBufferAllocator

- All Implemented Interfaces:
    ByteBufferAllocator

      @Immutable
      public class DirectByteBufferAllocator
      extends Object
      implements ByteBufferAllocator

  Allocates `ByteBuffer` instances using `ByteBuffer.allocateDirect(int)`.
  Since:
    4.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static DirectByteBufferAllocator` | `INSTANCE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DirectByteBufferAllocator()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ByteBuffer` | `allocate(int size)` Allocates `ByteBuffer` of the given size.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### INSTANCE

          public static final DirectByteBufferAllocator INSTANCE

  - ### Constructor Detail

    - #### DirectByteBufferAllocator

          public DirectByteBufferAllocator()

  - ### Method Detail

    - #### allocate

          public ByteBuffer allocate(int size)

      Description copied from interface: `ByteBufferAllocator`
      Allocates `ByteBuffer` of the given size.
      Specified by:
        `allocate` in interface `ByteBufferAllocator`
      Parameters:
        `size` - the size of the buffer.
      Returns:
        byte buffer.

Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.