Lines Matching refs:buffer
85 * Reads data into the provided buffer
87 * @param buffer to read into
90 public int read(ByteBuffer buffer) throws IOException {
91 if (buffer.isDirect()) {
92 return native_read_direct(buffer, buffer.remaining());
93 } else if (buffer.hasArray()) {
94 return native_read_array(buffer.array(), buffer.remaining());
96 throw new IllegalArgumentException("buffer is not direct and has no array");
101 * Writes data from provided buffer
103 * @param buffer to write
106 public void write(ByteBuffer buffer, int length) throws IOException {
107 if (buffer.isDirect()) {
108 native_write_direct(buffer, length);
109 } else if (buffer.hasArray()) {
110 native_write_array(buffer.array(), length);
112 throw new IllegalArgumentException("buffer is not direct and has no array");
125 private native int native_read_array(byte[] buffer, int length) throws IOException;
126 private native int native_read_direct(ByteBuffer buffer, int length) throws IOException;
127 private native void native_write_array(byte[] buffer, int length) throws IOException;
128 private native void native_write_direct(ByteBuffer buffer, int length) throws IOException;