com.plumtree.openfoundation.io
Class XPFileInputStream

java.lang.Object
  extended bycom.plumtree.openfoundation.io.XPInputStream
      extended bycom.plumtree.openfoundation.io.XPFileInputStream

public class XPFileInputStream
extends XPInputStream

XPFileInputStream corresponds to java.io.FileInputStream or System.IO.FileStream.


Constructor Summary
XPFileInputStream(java.io.FileInputStream fileStream)
          Creates a new XPFileInputStream object that wraps the FileInputStream.
XPFileInputStream(java.lang.String fileName)
          Creates a new XPFileInputStream object by opening a connection to an actual file named by the filename.
 
Method Summary
 void Close()
          Closes this file input stream and releases any system resources associated with the stream.
 int GetAvailableBytes()
          Returns the number of bytes that can be read from this file 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 the length of buffer 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

XPFileInputStream

public XPFileInputStream(java.io.FileInputStream fileStream)
Creates a new XPFileInputStream object that wraps the FileInputStream.

Parameters:
fileStream - An instance of FileInputStream

XPFileInputStream

public XPFileInputStream(java.lang.String fileName)
Creates a new XPFileInputStream object by opening a connection to an actual file named by the filename.

Parameters:
fileName - the system-dependent file name
Method Detail

Close

public void Close()
Closes this file input stream and releases any system resources associated with the stream.

Overrides:
Close in class XPInputStream
Throws:
XPIOException

GetAvailableBytes

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

Overrides:
GetAvailableBytes in class XPInputStream
Returns:
the number of bytes that can be read from this file input stream without blocking.
Throws:
XPIOException

GetUnderlyingObject

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

Overrides:
GetUnderlyingObject in class XPInputStream
Returns:
An instance of FileInputStream class. To get a FileInputStream object upcast the return value as in (FileInputStream)XPFileInputStream.GetUnderlyingObject();.

Read

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

Overrides:
Read in class XPInputStream
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 the length of buffer bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

Overrides:
Read in class XPInputStream
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.

Overrides:
Read in class XPInputStream
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.

Overrides:
Skip in class XPInputStream
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.