|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
public abstract class InputStream
InputStream is an abstract class for all byte input streams. It provides basic method implementations for reading bytes from a stream.
OutputStream| Constructor Summary | |
|---|---|
InputStream()
This constructor does nothing interesting. |
|
| Method Summary | |
|---|---|
int |
available()
Answers a int representing then number of bytes that are available before this InputStream will block. |
void |
close()
Close the InputStream. |
void |
mark(int readlimit)
Set a Mark position in this InputStream. |
boolean |
markSupported()
Answers a boolean indicating whether or not this InputStream supports mark() and reset(). |
abstract int |
read()
Reads a single byte from this InputStream and returns the result as an int. |
int |
read(byte[] b)
Reads bytes from the Stream and stores them in byte array b. |
int |
read(byte[] b,
int offset,
int length)
Reads at most length bytes from the Stream and stores them
in byte array b starting at offset. |
void |
reset()
Reset this InputStream to the last marked location. |
long |
skip(long n)
Skips n number of bytes in this InputStream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, println, toString |
| Constructor Detail |
|---|
public InputStream()
| Method Detail |
|---|
public int available()
throws IOException
IOException - If an error occurs in this InputStream.
public void close()
throws IOException
IOException - If an error occurs attempting to close this InputStream.public void mark(int readlimit)
readLimit indicates how many bytes can be read before a
mark is invalidated. Sending reset() will reposition the Stream back to
the marked position provided readLimit has not been
surpassed.
This default implementation does nothing and concrete subclasses must provide their own implementations.
readlimit - the number of bytes to be able to read before invalidating the
mark.public boolean markSupported()
true if mark() and reset() are supported,
false otherwise.
public abstract int read()
throws IOException
IOException - If the stream is already closed or another IOException
occurs.
public int read(byte[] b)
throws IOException
b.
Answer the number of bytes actually read or -1 if no bytes were read and
end of stream was encountered.
b - the byte array in which to store the read bytes.
IOException - If the stream is already closed or another IOException
occurs.
public int read(byte[] b,
int offset,
int length)
throws IOException
length bytes from the Stream and stores them
in byte array b starting at offset. Answer
the number of bytes actually read or -1 if no bytes were read and end of
stream was encountered.
b - the byte array in which to store the read bytes.offset - the offset in b to store the read bytes.length - the maximum number of bytes to store in b.
IOException - If the stream is already closed or another IOException
occurs.
public void reset()
throws IOException
readlimit has been passed or no mark has
been set, throw IOException. This implementation throws IOException and
concrete subclasses should provide proper implementations.
IOException - If the stream is already closed or another IOException
occurs.
public long skip(long n)
throws IOException
n number of bytes in this InputStream. Subsequent
read()'s will not return these bytes unless
reset() is used. This method may perform multiple reads to
read n bytes. This default implementation reads
n bytes into a temporary buffer. Concrete subclasses
should provide their own implementation.
n - the number of bytes to skip.
IOException - If the stream is already closed or another IOException
occurs.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||