src/main/java/com/spinyowl/legui/util/IOUtil.java
public static ByteBuffer resourceToByteBuffer(InputStream stream) throws IOException {
    if (stream == null) {
      throw new IllegalArgumentException("InputStream can not be null!");
    }
    byte[] bytes = IOUtils.toByteArray(stream);
    ByteBuffer data = ByteBuffer.allocateDirect(bytes.length).order(ByteOrder.nativeOrder())
        .put(bytes);
    data.flip();
    return data;
  }
/**
   * Creates {@link ByteBuffer} from stream.
   *
   * @param stream stream to read.
   * @return stream data or null.
   * @throws IOException in case if any IO exception occurs.
   */
Creates  ByteBuffer from stream.
@param stream stream to read.
@return stream data or null.
@throws IOException in case if any IO exception occurs.
Creates ByteBuffer from stream . @param stream stream to read . @return stream data or null . @throws IOException in case if any IO exception occurs .
public static ByteBuffer resourceToByteBuffer(InputStream stream) throws IOException {
    if (stream == null) {
      throw new IllegalArgumentException("InputStream can not be null!");
    }
    byte[] bytes = IOUtils.toByteArray(stream);
    ByteBuffer data = ByteBuffer.allocateDirect(bytes.length).order(ByteOrder.nativeOrder())
        .put(bytes);
    data.flip();
    return data;
  }
public static ByteBuffer resourceToByteBuffer ( InputStream stream ) throws IOException { if ( stream == null ) { throw new IllegalArgumentException ( "InputStream can not be null!" ) ; } byte [ ] bytes = IOUtils . toByteArray ( stream ) ; ByteBuffer data = ByteBuffer . allocateDirect ( bytes . length ) . order ( ByteOrder . nativeOrder ( ) ) . put ( bytes ) ; data . flip ( ) ; return data ; }
Creates {@link ByteBuffer} from stream.
Creates { @link ByteBuffer } from stream .