com.plumtree.openfoundation.io
Class XPInputStream

java.lang.Object
  extended by com.plumtree.openfoundation.io.XPInputStream
Direct Known Subclasses:
XPFileInputStream

public class XPInputStream
extends java.lang.Object

XPInputStream is a wrapper over the InputStream.


Constructor Summary
protected XPInputStream()
          Constructs a new XPInputStream object.
  XPInputStream(java.io.InputStream stream)
          Creates a new XPInputStream object that wraps the InputStream.
 
Method Summary
 void Close()
          Close the stream.
 int GetAvailableBytes()
          Returns the number of bytes that can be read from this input stream without blocking.
 java.io.InputStream GetUnderlyingObject()
          Returns the platform specific object that this class wraps.
 int Read()
          Reads a byte of data from this input stream.
 int Read(byte[] buffer)
          Reads up to b.length bytes of data from this input stream into an array of bytes.
 int Read(byte[] buffer, int offset, int count)
          Reads up to count bytes of data from this input stream into an array of bytes.
 long Skip(long n)
          Skips over and discards n bytes of data from the input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPInputStream

protected XPInputStream()
Constructs a new XPInputStream object.


XPInputStream

public XPInputStream(java.io.InputStream stream)
Creates a new XPInputStream object that wraps the InputStream.

Parameters:
stream - An instance of InputStream
Method Detail

Close

public void Close()
Close the stream.

Throws:
XPIOException - An instance of XPIOException

GetAvailableBytes

public int GetAvailableBytes()
Returns the number of bytes that can be read from this input stream without blocking.

Returns:
the number of bytes that can be read from this input stream without blocking.
Throws:
XPIOException

GetUnderlyingObject

public java.io.InputStream GetUnderlyingObject()
Returns the platform specific object that this class wraps.

Returns:
An instance of InputStream class

Read

public int Read()
Reads a byte of data from this input stream. This method blocks if no input is yet available.

Returns:
the next byte of data, or -1 if the end of the file is reached.
Throws:
XPIOException

Read

public int Read(byte[] buffer)
Reads up to b.length bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

Parameters:
buffer - the buffer into which the data is read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached.
Throws:
XPIOException

Read

public int Read(byte[] buffer,
                int offset,
                int count)
Reads up to count bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

Parameters:
buffer - the buffer into which the data is read.
offset - the start offset of the data.
count - the maximum number of bytes read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached.
Throws:
XPIOException

Skip

public long Skip(long n)
Skips over and discards n bytes of data from the input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.

Parameters:
n - the number of bytes to be skipped.
Returns:
the actual number of bytes skipped.
Throws:
XPIOException


Copyright © 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.