it.unimi.dsi.mg4j.io
Class FastByteArrayInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by it.unimi.dsi.fastutil.io.MeasurableInputStream
          extended by it.unimi.dsi.mg4j.io.FastByteArrayInputStream
All Implemented Interfaces:
RepositionableStream, Closeable

Deprecated. Moved to fastutil.

@Deprecated
public class FastByteArrayInputStream
extends MeasurableInputStream
implements RepositionableStream

Simple, fast and repositionable byte-array input stream.

Warning: this class implements the correct semantics of read(byte[], int, int) as described in InputStream. The implementation given in ByteArrayInputStream is broken, but it will never be fixed because it's too late.

Since:
0.6
Author:
Sebastiano Vigna

Field Summary
 byte[] array
          Deprecated. The array backing the input stream.
 int length
          Deprecated. The number of valid bytes in array starting from offset.
 int offset
          Deprecated. The first valid entry.
 
Constructor Summary
FastByteArrayInputStream(byte[] array)
          Deprecated. Creates a new array input stream using a given array.
FastByteArrayInputStream(byte[] array, int offset, int length)
          Deprecated. Creates a new array input stream using a given array fragment.
 
Method Summary
 int available()
          Deprecated.  
 void close()
          Deprecated. Closing a fast byte array input stream has no effect.
 long length()
          Deprecated.  
 void mark(int dummy)
          Deprecated.  
 boolean markSupported()
          Deprecated.  
 long position()
          Deprecated.  
 void position(long newPosition)
          Deprecated.  
 int read()
          Deprecated.  
 int read(byte[] b, int offset, int length)
          Deprecated. Reads bytes from this byte-array input stream as specified in InputStream.read(byte[], int, int).
 void reset()
          Deprecated.  
 long skip(long n)
          Deprecated.  
 
Methods inherited from class java.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

array

public byte[] array
Deprecated. 
The array backing the input stream.


offset

public int offset
Deprecated. 
The first valid entry.


length

public int length
Deprecated. 
The number of valid bytes in array starting from offset.

Constructor Detail

FastByteArrayInputStream

public FastByteArrayInputStream(byte[] array,
                                int offset,
                                int length)
Deprecated. 
Creates a new array input stream using a given array fragment.

Parameters:
array - the backing array.
offset - the first valid entry of the array.
length - the number of valid bytes.

FastByteArrayInputStream

public FastByteArrayInputStream(byte[] array)
Deprecated. 
Creates a new array input stream using a given array.

Parameters:
array - the backing array.
Method Detail

markSupported

public boolean markSupported()
Deprecated. 
Overrides:
markSupported in class InputStream

reset

public void reset()
Deprecated. 
Overrides:
reset in class InputStream

close

public void close()
Deprecated. 
Closing a fast byte array input stream has no effect.

Specified by:
close in interface Closeable
Overrides:
close in class InputStream

mark

public void mark(int dummy)
Deprecated. 
Overrides:
mark in class InputStream

available

public int available()
Deprecated. 
Overrides:
available in class InputStream

skip

public long skip(long n)
Deprecated. 
Overrides:
skip in class InputStream

read

public int read()
Deprecated. 
Specified by:
read in class InputStream

read

public int read(byte[] b,
                int offset,
                int length)
Deprecated. 
Reads bytes from this byte-array input stream as specified in InputStream.read(byte[], int, int). Note that the implementation given in ByteArrayInputStream.read(byte[], int, int) will return -1 on a zero-length read at EOF, contrarily to the specification. We won't.

Overrides:
read in class InputStream

position

public long position()
Deprecated. 
Specified by:
position in interface RepositionableStream
Specified by:
position in class MeasurableInputStream

position

public void position(long newPosition)
Deprecated. 
Specified by:
position in interface RepositionableStream

length

public long length()
Deprecated. 
Specified by:
length in class MeasurableInputStream