|
|||||||||
| Home >> All >> org >> mom4j >> xcp >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.mom4j.xcp.util
Class LimitedReader

java.lang.Objectjava.io.Reader
java.io.InputStreamReader
org.mom4j.xcp.util.LimitedReader
- public class LimitedReader
- extends java.io.InputStreamReader
| Field Summary | |
private long |
chars
|
private boolean |
ignoreClose
|
private long |
limit
|
| Fields inherited from class java.io.InputStreamReader |
|
| Fields inherited from class java.io.Reader |
lock |
| Constructor Summary | |
LimitedReader(java.io.InputStream in,
long limit)
|
|
LimitedReader(java.io.InputStream in,
long limit,
boolean ignoreClose)
|
|
| Method Summary | |
void |
close()
This method closes this stream, as well as the underlying InputStream. |
java.lang.String |
getEncoding()
This method returns the name of the encoding that is currently in use by this object. |
void |
mark(int param)
Marks a position in the input to which the stream can be "reset" by calling the reset() method. |
boolean |
markSupported()
Returns a boolean that indicates whether the mark/reset methods are supported in this class. |
int |
read()
Reads an char from the input stream and returns it as an int in the range of 0-65535. |
int |
read(char[] values)
Reads chars from a stream and stores them into a caller supplied buffer. |
int |
read(char[] values,
int off,
int len)
This method reads up to length characters from the stream into
the specified array starting at index offset into the
array. |
boolean |
ready()
This method checks to see if the stream is ready to be read. |
void |
reset()
Resets a stream to the point where the mark()
method was called. |
long |
skip(long param)
Skips the specified number of chars in the stream. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
limit
private long limit
chars
private long chars
ignoreClose
private boolean ignoreClose
| Constructor Detail |
LimitedReader
public LimitedReader(java.io.InputStream in, long limit) throws java.io.UnsupportedEncodingException
LimitedReader
public LimitedReader(java.io.InputStream in, long limit, boolean ignoreClose) throws java.io.UnsupportedEncodingException
| Method Detail |
close
public void close()
throws java.io.IOException
- Description copied from class:
java.io.InputStreamReader - This method closes this stream, as well as the underlying
InputStream.
mark
public void mark(int param)
throws java.io.IOException
- Description copied from class:
java.io.Reader - Marks a position in the input to which the stream can be
"reset" by calling the
reset()method. The parameterreadlimitis the number of chars that can be read from the stream after setting the mark before the mark becomes invalid. For example, ifmark()is called with a read limit of 10, then when 11 chars of data are read from the stream before thereset()method is called, then the mark is invalid and the stream object instance is not required to remember the mark.
markSupported
public boolean markSupported()
- Description copied from class:
java.io.Reader - Returns a boolean that indicates whether the mark/reset
methods are supported in this class. Those methods can be used to
remember a specific point in the stream and reset the stream to that
point.
This method always returns
falsein this class, but subclasses can override this method to returntrueif they support mark/reset functionality.
read
public int read()
throws java.io.IOException
- Description copied from class:
java.io.InputStreamReader - Reads an char from the input stream and returns it
as an int in the range of 0-65535. This method also will return -1 if
the end of the stream has been reached.
This method will block until the char can be read.
read
public int read(char[] values)
throws java.io.IOException
- Description copied from class:
java.io.Reader - Reads chars from a stream and stores them into a caller
supplied buffer. This method attempts to completely fill the buffer,
but can return before doing so. The actual number of chars read is
returned as an int. A -1 is returned to indicate the end of the stream.
This method will block until some data can be read.
This method operates by calling an overloaded read method like so:
read(buf, 0, buf.length)
read
public int read(char[] values,
int off,
int len)
throws java.io.IOException
- Description copied from class:
java.io.InputStreamReader - This method reads up to
lengthcharacters from the stream into the specified array starting at indexoffsetinto the array.
ready
public boolean ready()
throws java.io.IOException
- Description copied from class:
java.io.InputStreamReader - This method checks to see if the stream is ready to be read. It
will return
trueif is, orfalseif it is not. If the stream is not ready to be read, it could (although is not required to) block on the next read attempt.
reset
public void reset()
throws java.io.IOException
- Description copied from class:
java.io.Reader - Resets a stream to the point where the
mark()method was called. Any chars that were read after the mark point was set will be re-read during subsequent reads.This method always throws an IOException in this class, but subclasses can override this method if they provide mark/reset functionality.
skip
public long skip(long param)
throws java.io.IOException
- Description copied from class:
java.io.InputStreamReader - Skips the specified number of chars in the stream. It
returns the actual number of chars skipped, which may be less than the
requested amount.
getEncoding
public java.lang.String getEncoding()
- Description copied from class:
java.io.InputStreamReader - This method returns the name of the encoding that is currently in use
by this object. If the stream has been closed, this method is allowed
to return
null.
|
|||||||||
| Home >> All >> org >> mom4j >> xcp >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC