Sunday 10 March 2013

available()


available()

Declaration:
public int available()
throws IOException
Description:
Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by
the next caller of a method for this input stream. The next caller might be the same thread or another thread.
The available method for class InputStream always returns 0.
This method should be overridden by subclasses.
Returns: the number of bytes that can be read from this input stream without blocking.
Throws:
IOException - if an I/O error occurs.
close()
Declaration:
public void close()
throws IOException
Description:
Closes this input stream and releases any system resources associated with the stream.
The close method of InputStream does nothing.
Throws:
IOException - if an I/O error occurs.

mark(int)

mark(int)
Declaration:
public void mark(int readlimit)
Description:
Marks the current position in this input stream. A subsequent call to the reset method repositions this
stream at the last marked position so that subsequent reads re-read the same bytes.
The readlimit arguments tells this input stream to allow that many bytes to be read before the mark
position gets invalidated.
The general contract of mark is that, if the method markSupported returns true, the stream somehow
remembers all the bytes read after the call to mark and stands ready to supply those same bytes again if and
whenever the method reset is called. However, the stream is not required to remember any data at all if
more than readlimit bytes are read from the stream before reset is called.
The mark method of InputStream does nothing.
Parameters:
readlimit - the maximum limit of bytes that can be read before the mark position becomes invalid.
See Also: reset()
reset()
Declaration:
public void reset()
throws IOException
Description:
Repositions this stream to the position at the time the mark method was last called on this input stream.
The general contract of reset is:
• If the method markSupported returns true, then:
• If the method mark has not been called since the stream was created, or the number of bytes read
from the stream since mark was last called is larger than the argument to mark at that last call, then
an IOException might be thrown.
• If such an IOException is not thrown, then the stream is reset to a state such that all the bytes read
since the most recent call to mark (or since the start of the file, if mark has not been called) will be
resupplied to subsequent callers of the read method, followed by any bytes that otherwise would
have been the next input data as of the time of the call to reset.
• If the method markSupported returns false, then:
• The call to reset may throw an IOException.
• If an IOException is not thrown, then the stream is reset to a fixed state that depends on the
particular type of the input stream and how it was created. The bytes that will be supplied to
subsequent callers of the read method depend on the particular type of the input stream.
The method reset for class InputStream does nothing and always throws an IOException.
Throws:
IOException - if this stream has not been marked or if the mark has been invalidated.


markSupported()
Declaration:
public boolean markSupported()
Description:
Tests if this input stream supports the mark and reset methods. The markSupported method of
InputStream returns false.
Returns: true if this true type supports the mark and reset method; false otherwise.
See Also: mark(int), reset()




No comments:

Post a Comment