com.hazelcast.nio
Class FastByteArrayInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.ByteArrayInputStream
          extended by com.hazelcast.nio.FastByteArrayInputStream
All Implemented Interfaces:
java.io.Closeable, java.io.DataInput

public class FastByteArrayInputStream
extends java.io.ByteArrayInputStream
implements java.io.DataInput


Field Summary
 
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos
 
Constructor Summary
FastByteArrayInputStream(byte[] buf)
           
FastByteArrayInputStream(byte[] buf, int offset, int length)
           
 
Method Summary
 int available()
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 boolean readBoolean()
           
 byte readByte()
          See the general contract of the readByte method of DataInput.
 char readChar()
          See the general contract of the readChar method of DataInput.
 double readDouble()
          See the general contract of the readDouble method of DataInput.
 float readFloat()
          See the general contract of the readFloat method of DataInput.
 void readFully(byte[] b)
           
 void readFully(byte[] b, int off, int len)
           
 int readInt()
          See the general contract of the readInt method of DataInput.
 java.lang.String readLine()
          Deprecated. This method does not properly convert bytes to characters. As of JDK 1.1, the preferred way to read lines of text is via the BufferedReader.readLine() method. Programs that use the DataInputStream class to read lines can be converted to use the BufferedReader class by replacing code of the form:

                                                                                                                                                                                     DataInputStream d = new DataInputStream(in);
                                                                                                                                                                                     
with:
                                                                                                                                                                                     BufferedReader d = new BufferedReader(new InputStreamReader(in));
                                                                                                                                                                                     
 long readLong()
          See the general contract of the readLong method of DataInput.
 short readShort()
          See the general contract of the readShort method of DataInput.
 int readUnsignedByte()
          See the general contract of the readUnsignedByte method of DataInput.
 int readUnsignedShort()
          See the general contract of the readUnsignedShort method of DataInput.
 java.lang.String readUTF()
          See the general contract of the readUTF method of DataInput.
 void reset()
           
 void set(byte[] bytes, int size)
           
 long skip(long n)
           
 int skipBytes(int n)
           
 
Methods inherited from class java.io.ByteArrayInputStream
close, mark
 
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
 

Constructor Detail

FastByteArrayInputStream

public FastByteArrayInputStream(byte[] buf)

FastByteArrayInputStream

public FastByteArrayInputStream(byte[] buf,
                                int offset,
                                int length)
Method Detail

read

public int read()
Overrides:
read in class java.io.ByteArrayInputStream

read

public int read(byte[] b,
                int off,
                int len)
Overrides:
read in class java.io.ByteArrayInputStream

skip

public long skip(long n)
Overrides:
skip in class java.io.ByteArrayInputStream

skipBytes

public final int skipBytes(int n)
                    throws java.io.IOException
Specified by:
skipBytes in interface java.io.DataInput
Throws:
java.io.IOException

available

public int available()
Overrides:
available in class java.io.ByteArrayInputStream

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.ByteArrayInputStream

reset

public void reset()
Overrides:
reset in class java.io.ByteArrayInputStream

set

public void set(byte[] bytes,
                int size)

readBoolean

public final boolean readBoolean()
                          throws java.io.IOException
Specified by:
readBoolean in interface java.io.DataInput
Throws:
java.io.IOException

readByte

public final byte readByte()
                    throws java.io.IOException
See the general contract of the readByte method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readByte in interface java.io.DataInput
Returns:
the next byte of this input stream as a signed 8-bit byte.
Throws:
java.io.EOFException - if this input stream has reached the end.
java.io.IOException - if an I/O error occurs.
See Also:
FilterInputStream.in

readChar

public final char readChar()
                    throws java.io.IOException
See the general contract of the readChar method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readChar in interface java.io.DataInput
Returns:
the next two bytes of this input stream as a Unicode character.
Throws:
java.io.EOFException - if this input stream reaches the end before reading two bytes.
java.io.IOException - if an I/O error occurs.
See Also:
FilterInputStream.in

readDouble

public final double readDouble()
                        throws java.io.IOException
See the general contract of the readDouble method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readDouble in interface java.io.DataInput
Returns:
the next eight bytes of this input stream, interpreted as a double.
Throws:
java.io.EOFException - if this input stream reaches the end before reading eight bytes.
java.io.IOException - if an I/O error occurs.
See Also:
DataInputStream.readLong(), Double.longBitsToDouble(long)

readFloat

public final float readFloat()
                      throws java.io.IOException
See the general contract of the readFloat method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readFloat in interface java.io.DataInput
Returns:
the next four bytes of this input stream, interpreted as a float.
Throws:
java.io.EOFException - if this input stream reaches the end before reading four bytes.
java.io.IOException - if an I/O error occurs.
See Also:
DataInputStream.readInt(), Float.intBitsToFloat(int)

readFully

public final void readFully(byte[] b)
                     throws java.io.IOException
Specified by:
readFully in interface java.io.DataInput
Throws:
java.io.IOException

readFully

public final void readFully(byte[] b,
                            int off,
                            int len)
                     throws java.io.IOException
Specified by:
readFully in interface java.io.DataInput
Throws:
java.io.IOException

readInt

public final int readInt()
                  throws java.io.IOException
See the general contract of the readInt method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readInt in interface java.io.DataInput
Returns:
the next four bytes of this input stream, interpreted as an int.
Throws:
java.io.EOFException - if this input stream reaches the end before reading four bytes.
java.io.IOException - if an I/O error occurs.
See Also:
FilterInputStream.in

readLine

@Deprecated
public final java.lang.String readLine()
                                throws java.io.IOException
Deprecated. This method does not properly convert bytes to characters. As of JDK 1.1, the preferred way to read lines of text is via the BufferedReader.readLine() method. Programs that use the DataInputStream class to read lines can be converted to use the BufferedReader class by replacing code of the form:

                                                                                                                                                                                     DataInputStream d = new DataInputStream(in);
                                                                                                                                                                                     
with:
                                                                                                                                                                                     BufferedReader d = new BufferedReader(new InputStreamReader(in));
                                                                                                                                                                                     

See the general contract of the readLine method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readLine in interface java.io.DataInput
Returns:
the next line of text from this input stream.
Throws:
java.io.IOException - if an I/O error occurs.
See Also:
BufferedReader.readLine(), FilterInputStream.in

readLong

public final long readLong()
                    throws java.io.IOException
See the general contract of the readLong method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readLong in interface java.io.DataInput
Returns:
the next eight bytes of this input stream, interpreted as a long.
Throws:
java.io.EOFException - if this input stream reaches the end before reading eight bytes.
java.io.IOException - if an I/O error occurs.
See Also:
FilterInputStream.in

readShort

public final short readShort()
                      throws java.io.IOException
See the general contract of the readShort method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readShort in interface java.io.DataInput
Returns:
the next two bytes of this input stream, interpreted as a signed 16-bit number.
Throws:
java.io.EOFException - if this input stream reaches the end before reading two bytes.
java.io.IOException - if an I/O error occurs.
See Also:
FilterInputStream.in

readUnsignedByte

public final int readUnsignedByte()
                           throws java.io.IOException
See the general contract of the readUnsignedByte method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readUnsignedByte in interface java.io.DataInput
Returns:
the next byte of this input stream, interpreted as an unsigned 8-bit number.
Throws:
java.io.EOFException - if this input stream has reached the end.
java.io.IOException - if an I/O error occurs.
See Also:
FilterInputStream.in

readUnsignedShort

public final int readUnsignedShort()
                            throws java.io.IOException
See the general contract of the readUnsignedShort method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readUnsignedShort in interface java.io.DataInput
Returns:
the next two bytes of this input stream, interpreted as an unsigned 16-bit integer.
Throws:
java.io.EOFException - if this input stream reaches the end before reading two bytes.
java.io.IOException - if an I/O error occurs.
See Also:
FilterInputStream.in

readUTF

public final java.lang.String readUTF()
                               throws java.io.IOException
See the general contract of the readUTF method of DataInput.

Bytes for this operation are read from the contained input stream.

Specified by:
readUTF in interface java.io.DataInput
Returns:
a Unicode string.
Throws:
java.io.EOFException - if this input stream reaches the end before reading all the bytes.
java.io.IOException - if an I/O error occurs.
java.io.UTFDataFormatException - if the bytes do not represent a valid modified UTF-8 encoding of a string.
See Also:
DataInputStream.readUTF(java.io.DataInput)


Copyright © 2012 Hazel Bilisim Ltd.. All Rights Reserved.