org.apache.derby.impl.io.vfmem
Class BlockedByteArrayInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.apache.derby.impl.io.vfmem.BlockedByteArrayInputStream
All Implemented Interfaces:
java.io.Closeable

 class BlockedByteArrayInputStream
extends java.io.InputStream

An input stream reading from a blocked byte array.


Field Summary
private  long pos
          The current position of the stream.
private  BlockedByteArray src
          The underlying source.
 
Constructor Summary
BlockedByteArrayInputStream(BlockedByteArray src, long pos)
          Creates a new input stream reading from a blocked byte array.
 
Method Summary
 void close()
          Closes the stream.
(package private)  long getPosition()
          Returns the current position.
 int read()
          Reads a single byte.
 int read(byte[] buf, int offset, int len)
          Reads up to len bytes.
(package private)  void setPosition(long newPos)
          Sets the position.
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

src

private BlockedByteArray src
The underlying source. Set to null when closed.


pos

private long pos
The current position of the stream.

Constructor Detail

BlockedByteArrayInputStream

public BlockedByteArrayInputStream(BlockedByteArray src,
                                   long pos)
Creates a new input stream reading from a blocked byte array.

Parameters:
src - the source blocked byte array
pos - the initial position to start reading from
Method Detail

setPosition

void setPosition(long newPos)
Sets the position.

Parameters:
newPos - the new byte position

getPosition

long getPosition()
Returns the current position.

Returns:
The current byte position.

read

public int read()
Reads a single byte.

Specified by:
read in class java.io.InputStream
Returns:
A byte.

read

public int read(byte[] buf,
                int offset,
                int len)
Reads up to len bytes.

Overrides:
read in class java.io.InputStream
Parameters:
buf - destination buffer
offset - offset into the destination buffer
len - number of bytes to read
Returns:
The number of bytes read.

close

public void close()
Closes the stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.