|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Reader
oracle.adfnmc.java.io.BufferedReader
oracle.adfnmc.java.io.LineNumberReader
public class LineNumberReader
LineNumberReader is a buffered character input reader which counts line numbers as data is being read. The line number starts at 0 and is incremented any time '\r', '\n', or '\r\n' is read.
Field Summary |
---|
Fields inherited from class java.io.Reader |
---|
lock |
Constructor Summary | |
---|---|
LineNumberReader(java.io.Reader in)
Constructs a new buffered LineNumberReader on the Reader in . |
|
LineNumberReader(java.io.Reader in,
int size)
Constructs a new buffered LineNumberReader on the Reader in . |
Method Summary | |
---|---|
int |
getLineNumber()
Answers a int representing the current line number for this LineNumberReader. |
void |
mark(int readlimit)
Set a Mark position in this LineNumberReader. |
int |
read()
Reads a single char from this LineNumberReader and returns the result as an int. |
int |
read(char[] buffer,
int offset,
int count)
Reads at most count chars from this LineNumberReader and
stores them in char array buffer starting at offset
offset . |
java.lang.String |
readLine()
Answers a String representing the next line of text
available in this LineNumberReader. |
void |
reset()
Reset this LineNumberReader to the last marked location. |
void |
setLineNumber(int lineNumber)
Sets the lineNumber of this LineNumberReader to the specified lineNumber . |
long |
skip(long count)
Skips count number of chars in this LineNumberReader. |
Methods inherited from class oracle.adfnmc.java.io.BufferedReader |
---|
close, markSupported, ready |
Methods inherited from class java.io.Reader |
---|
read |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LineNumberReader(java.io.Reader in)
in
.
The default buffer size (8K) is allocated and all reads can now be
filtered through this LineNumberReader.
in
- the Reader to buffer reads on.public LineNumberReader(java.io.Reader in, int size)
in
.
The buffer size is specified by the parameter size
and all
reads can now be filtered through this LineNumberReader.
in
- the Reader to buffer reads on.size
- the size of buffer to allocate.Method Detail |
---|
public int getLineNumber()
public void mark(int readlimit) throws java.io.IOException
readLimit
indicates how many characters can be read before
a mark is invalidated. Sending reset() will reposition the reader back to
the marked position provided readLimit
has not been
surpassed. The lineNumber associated with this marked position will also
be saved and restored when reset() is sent provided
readLimit
has not been surpassed.
mark
in class BufferedReader
readlimit
- an int representing how many characters must be read before
invalidating the mark.
java.io.IOException
- If an error occurs attempting mark this LineNumberReader.public int read() throws java.io.IOException
read
in class BufferedReader
java.io.IOException
- If the reader is already closed or another IOException
occurs.public int read(char[] buffer, int offset, int count) throws java.io.IOException
count
chars from this LineNumberReader and
stores them in char array buffer
starting at offset
offset
. Answer the number of chars actually read or -1 if
no chars were read and end of reader was encountered. This implementation
reads chars from the target stream. The line number count is incremented
if a line terminator is encountered. A line delimiter sequence is
determined by '\r', '\n', or '\r\n'. In this method, the sequence is
always translated into '\n'.
read
in class BufferedReader
buffer
- the char array in which to store the read chars.offset
- the offset in buffer
to store the read chars.count
- the maximum number of chars to store in buffer
.
java.io.IOException
- If the reader is already closed or another IOException
occurs.public java.lang.String readLine() throws java.io.IOException
String
representing the next line of text
available in this LineNumberReader. A line is represented by 0 or more
characters followed by '\n'
, '\r'
,
"\n\r"
or end of stream. The String
does
not include the newline sequence.
readLine
in class BufferedReader
java.io.IOException
- If the LineNumberReader is already closed or some other IO
error occurs.public void reset() throws java.io.IOException
readlimit
has been passed or no mark
has
been set, throw IOException. This implementation resets the target
reader. It also resets the line count to what is was when this reader was
marked.
reset
in class BufferedReader
java.io.IOException
- If the reader is already closed or another IOException
occurs.public void setLineNumber(int lineNumber)
lineNumber
. Note that this may have side effects on the
line number associated with the last marked position.
lineNumber
- the new lineNumber value.public long skip(long count) throws java.io.IOException
count
number of chars in this LineNumberReader.
Subsequent read()
's will not return these chars unless
reset()
is used. This implementation skips
count
number of chars in the target stream and increments
the lineNumber count as chars are skipped.
skip
in class BufferedReader
count
- the number of chars to skip.
java.io.IOException
- If the reader is already closed or another IOException
occurs.
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |