|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--com.novell.java.io.NInputStream
Provides input stream functionality to various data device object, which implements the DataAccessable interface.
The various constructors open an input stream on (or with) the DataAccessable object passed into the constructors. The DataAccessable object might have container capabilities and support subordinate streams, or it may support only a stream to itself. The constructors with a name parameter (which must be atomic) will attempt to open a subordinate stream through the given DataAccessable object. The constructors without a name parameter attempt to open a stream on the given DataAcessable object.
A set of constructors is provided for the support of provider based custom parameters. A given implementation of a DataAccessable object might require custom parameters to open the stream. For example, a file system provider might require open flags, fork selectors, name space information, size, and so forth, to open the stream. The custom Object parameter allows for passing known provider-supplied objects to their DataAccessable implementations, allowing the user full control over the opening of the stream if needed. The various providers must implement reasonable defaults for any custom parameters if the non-custom constructors are used (open flags == READ). See Novell's DataAccessableParameters and NFileInputStream for an example of how a provider might implement this support.
A NoSubordinateAccessException will be thrown if the given DataAccessable object does not support subordinate streams (subordinate constructors). A SubordinateAccessOnlyException will be thrown if the given DataAccessable object does not support a stream on itself.
DataAccessable
,
NOutputStream
,
RandomAccess
,
NFileInputStream
,
DataAccessableParameters
Constructor Summary | |
NInputStream(DataAccessable accessor)
Creates an instance of the NInputStream. |
|
NInputStream(DataAccessable accessor,
java.lang.Object custom)
Creates an instance of NInputStream with the custom parameter. |
|
NInputStream(java.lang.String name,
DataAccessable accessor)
Creates a subordinate instance of NInputStream. |
|
NInputStream(java.lang.String name,
DataAccessable accessor,
java.lang.Object custom)
Creates a subordinate instance of NInputStream with the custom parameter. |
Method Summary | |
int |
available()
Returns bytes that are available to read without blocking. |
void |
close()
Closes the stream. |
void |
mark(int readLimit)
Saves the current position, which can then be restored by calling reset(). |
boolean |
markSupported()
Determines whether the mark() and reset() methods are valid for the stream. |
int |
read()
Reads a byte. |
int |
read(byte[] b)
Reads an array of bytes. |
int |
read(byte[] b,
int off,
int len)
Reads the specified number of bytes into an array. |
void |
reset()
Resets the stream position to the last position saved by calling mark(). |
long |
skip(long n)
Skips the specified number of bytes. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public NInputStream(DataAccessable accessor) throws java.io.IOException
Opens an input stream to the DataAccessable accessor parameter.
accessor
- The DataAccessable object to use.public NInputStream(DataAccessable accessor, java.lang.Object custom) throws java.io.IOException
Opens an input stream to the DataAccessable accessor parameter, passing the provider-based custom parameter to the accessor for the open.
accessor
- The DataAccessable object to use.custom
- Provider-specific custom object containing
any needed parameters to open the stream.public NInputStream(java.lang.String name, DataAccessable accessor) throws java.io.IOException
Opens a subordinate input stream to the DataAccessable accessor parameter.
name
- The atomic subordinate stream name to open.accessor
- The DataAccessable object to use.public NInputStream(java.lang.String name, DataAccessable accessor, java.lang.Object custom) throws java.io.IOException
Opens a subordinate input stream to the DataAccessable accessor parameter, passing the provider based custom parameter to the accessor for the open.
name
- The atomic subordinate stream name to open.accessor
- The DataAccessable object to use.custom
- Provider-specific custom object containing
any needed parameters to open the stream.Method Detail |
public int available() throws java.io.IOException
public void close() throws java.io.IOException
public void mark(int readLimit)
If markSupported() returns FALSE, mark() does nothing.
readLimit
- The limit to number of bytes that can
be read before the mark becomes invalid.public boolean markSupported()
public int read() throws java.io.IOException
public int read(byte[] b) throws java.io.IOException
b
- The array into which to read the bytes.public int read(byte[] b, int off, int len) throws java.io.IOException
b
- The array into which to read the bytes.off
- The offset in 'b' at which to start storing the
bytes read.len
- The number of bytes to read. At most, this number
of bytes will be read, but it could be less.public void reset() throws java.io.IOException
public long skip(long n) throws java.io.IOException
n
- The number of bytes to skip.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |