3838import java .io .EOFException ;
3939import java .io .IOException ;
4040import java .io .InputStreamReader ;
41- import java .nio .ByteBuffer ;
42- import java .nio .ByteOrder ;
4341
4442import org .scijava .io .location .Location ;
4543import org .scijava .plugin .WrapperPlugin ;
@@ -56,6 +54,10 @@ public interface DataHandle<L extends Location> extends WrapperPlugin<L>,
5654 DataInput , DataOutput , Closeable
5755{
5856
57+ public enum ByteOrder {
58+ LITTLE_ENDIAN , BIG_ENDIAN
59+ }
60+
5961 /** Default block size to use when searching through the stream. */
6062 int DEFAULT_BLOCK_SIZE = 256 * 1024 ; // 256 KB
6163
@@ -92,8 +94,6 @@ public interface DataHandle<L extends Location> extends WrapperPlugin<L>,
9294 * by this method:
9395 * </p>
9496 * <ul>
95- * <li>{@link #read(ByteBuffer)}</li>
96- * <li>{@link #read(ByteBuffer, int)}</li>
9797 * <li>{@link #read(byte[])}</li>
9898 * <li>{@link #read(byte[], int, int)}</li>
9999 * <li>{@link #skip(long)}</li>
@@ -191,62 +191,6 @@ default void setLittleEndian(final boolean little) {
191191 /** Sets the native encoding of the stream. */
192192 void setEncoding (String encoding );
193193
194- /**
195- * Reads up to {@code buf.remaining()} bytes of data from the stream into a
196- * {@link ByteBuffer}.
197- */
198- default int read (final ByteBuffer buf ) throws IOException {
199- return read (buf , buf .remaining ());
200- }
201-
202- /**
203- * Reads up to {@code len} bytes of data from the stream into a
204- * {@link ByteBuffer}.
205- *
206- * @return the total number of bytes read into the buffer.
207- */
208- default int read (final ByteBuffer buf , final int len ) throws IOException {
209- final int n ;
210- if (buf .hasArray ()) {
211- // read directly into the array
212- n = read (buf .array (), buf .arrayOffset (), len );
213- }
214- else {
215- // read into a temporary array, then copy
216- final byte [] b = new byte [len ];
217- n = read (b );
218- buf .put (b , 0 , n );
219- }
220- return n ;
221- }
222-
223- /**
224- * Writes {@code buf.remaining()} bytes of data from the given
225- * {@link ByteBuffer} to the stream.
226- */
227- default void write (final ByteBuffer buf ) throws IOException {
228- write (buf , buf .remaining ());
229- }
230-
231- /**
232- * Writes {@code len} bytes of data from the given {@link ByteBuffer} to the
233- * stream.
234- */
235- default void write (final ByteBuffer buf , final int len )
236- throws IOException
237- {
238- if (buf .hasArray ()) {
239- // write directly from the buffer's array
240- write (buf .array (), buf .arrayOffset (), len );
241- }
242- else {
243- // copy into a temporary array, then write
244- final byte [] b = new byte [len ];
245- buf .get (b );
246- write (b );
247- }
248- }
249-
250194 /** Reads a string of arbitrary length, terminated by a null char. */
251195 default String readCString () throws IOException {
252196 final String line = findString ("\0 " );
0 commit comments