/** * @param buffer * @param length * number of bytes to read * @return a BytesInput that will read the given bytes from the ByteBuffer * @deprecated Will be removed in 2.0.0 */ @Deprecated public static BytesInput from(ByteBuffer buffer, int offset, int length) { ByteBuffer tmp = buffer.duplicate(); tmp.position(offset); ByteBuffer slice = tmp.slice(); slice.limit(length); return new ByteBufferBytesInput(slice); }
/** * @param buffers a list of byte buffers * @return a BytesInput that will read the given bytes from the ByteBuffers */ public static BytesInput from(List<ByteBuffer> buffers) { if (buffers.size() == 1) { return new ByteBufferBytesInput(buffers.get(0)); } return new BufferListBytesInput(buffers); }
/** * @param buffers a list of byte buffers * @return a BytesInput that will read the given bytes from the ByteBuffers */ public static BytesInput from(List<ByteBuffer> buffers) { if (buffers.size() == 1) { return new ByteBufferBytesInput(buffers.get(0)); } return new BufferListBytesInput(buffers); }
/** * @param buffers an array of byte buffers * @return a BytesInput that will read the given bytes from the ByteBuffers */ public static BytesInput from(ByteBuffer... buffers) { if (buffers.length == 1) { return new ByteBufferBytesInput(buffers[0]); } return new BufferListBytesInput(Arrays.asList(buffers)); }
/** * @param buffers an array of byte buffers * @return a BytesInput that will read the given bytes from the ByteBuffers */ public static BytesInput from(ByteBuffer... buffers) { if (buffers.length == 1) { return new ByteBufferBytesInput(buffers[0]); } return new BufferListBytesInput(Arrays.asList(buffers)); }