org.jgroups.util
Class ExposedByteArrayInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.ByteArrayInputStream
          extended by org.jgroups.util.ExposedByteArrayInputStream
All Implemented Interfaces:
java.io.Closeable

public class ExposedByteArrayInputStream
extends java.io.ByteArrayInputStream

Author:
Bela Ban

Field Summary
 
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos
 
Constructor Summary
ExposedByteArrayInputStream(byte[] buf)
          Creates a ByteArrayInputStream so that it uses buf as its buffer array.
ExposedByteArrayInputStream(byte[] buf, int offset, int length)
          Creates ByteArrayInputStream that uses buf as its buffer array.
 
Method Summary
 int available()
           
 void close()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 void setData(byte[] buf, int offset, int length)
           
 long skip(long n)
           
 
Methods inherited from class java.io.ByteArrayInputStream
mark, markSupported
 
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

ExposedByteArrayInputStream

public ExposedByteArrayInputStream(byte[] buf)
Creates a ByteArrayInputStream so that it uses buf as its buffer array. The buffer array is not copied. The initial value of pos is 0 and the initial value of count is the length of buf.

Parameters:
buf - the input buffer.

ExposedByteArrayInputStream

public ExposedByteArrayInputStream(byte[] buf,
                                   int offset,
                                   int length)
Creates ByteArrayInputStream that uses buf as its buffer array. The initial value of pos is offset and the initial value of count is the minimum of offset+length and buf.length. The buffer array is not copied. The buffer's mark is set to the specified offset.

Parameters:
buf - the input buffer.
offset - the offset in the buffer of the first byte to read.
length - the maximum number of bytes to read from the buffer.
Method Detail

setData

public void setData(byte[] buf,
                    int offset,
                    int length)

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

available

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

reset

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

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.ByteArrayInputStream
Throws:
java.io.IOException


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.