jamod at SF

net.wimpi.modbus.io
Class FastByteArrayInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended bynet.wimpi.modbus.io.FastByteArrayInputStream
Direct Known Subclasses:
BytesInputStream

public class FastByteArrayInputStream
extends java.io.InputStream

This class is a replacement for ByteArrayInputStream that does not synchronize every byte read.

Version:
1.2rc1 (09/11/2004)
Author:
Mark Hayes, Dieter Wimberger

Field Summary
protected  byte[] buf
          Input buffer byte[].
protected  int count
          Number of bytes in the input buffer.
protected  int mark
          Marked position pointer into the input buffer.
protected  int pos
          Actual position pointer into the input buffer.
 
Constructor Summary
FastByteArrayInputStream(byte[] buffer)
          Creates an input stream.
FastByteArrayInputStream(byte[] buffer, int offset, int length)
          Creates an input stream.
 
Method Summary
 int available()
           
 byte[] getBufferBytes()
          Returns the underlying data being read.
 int getBufferLength()
          Returns the end of the buffer being read.
 int getBufferOffset()
          Returns the offset at which data is being read from the buffer.
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] toBuf)
           
 int read(byte[] toBuf, int offset, int length)
           
 void reset()
           
 long skip(long count)
           
 
Methods inherited from class java.io.InputStream
close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

count

protected int count
Number of bytes in the input buffer.


pos

protected int pos
Actual position pointer into the input buffer.


mark

protected int mark
Marked position pointer into the input buffer.


buf

protected byte[] buf
Input buffer byte[].

Constructor Detail

FastByteArrayInputStream

public FastByteArrayInputStream(byte[] buffer)
Creates an input stream.

Parameters:
buffer - the data to read.

FastByteArrayInputStream

public FastByteArrayInputStream(byte[] buffer,
                                int offset,
                                int length)
Creates an input stream.

Parameters:
buffer - the data to read.
offset - the byte offset at which to begin reading.
length - the number of bytes to read.
Method Detail

available

public int available()

markSupported

public boolean markSupported()

mark

public void mark(int readlimit)

reset

public void reset()

skip

public long skip(long count)

read

public int read()
         throws java.io.IOException
Throws:
java.io.IOException

read

public int read(byte[] toBuf)
         throws java.io.IOException
Throws:
java.io.IOException

read

public int read(byte[] toBuf,
                int offset,
                int length)
         throws java.io.IOException
Throws:
java.io.IOException

getBufferBytes

public byte[] getBufferBytes()
Returns the underlying data being read.

Returns:
the underlying data.

getBufferOffset

public int getBufferOffset()
Returns the offset at which data is being read from the buffer.

Returns:
the offset at which data is being read.

getBufferLength

public int getBufferLength()
Returns the end of the buffer being read.

Returns:
the end of the buffer.

jamod at SF

Copyright © 2002-2004 jamod development team.