|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Reader
net.jbeans.io.JBeansReader
JBeansReader reads strings and numbers from a reader or an input stream.
Reader
Field Summary | |
protected static java.lang.String |
STREAM_CLOSED
|
Fields inherited from class java.io.Reader |
lock |
Constructor Summary | |
JBeansReader(java.io.InputStream in)
Construct a newly created JBeansReader |
|
JBeansReader(java.io.InputStream in,
java.lang.String delim)
Construct a newly created JBeansReader |
|
JBeansReader(java.io.InputStream in,
java.lang.String delim,
boolean returnTokens)
Construct a newly created JBeansReader |
|
JBeansReader(java.io.Reader in)
Construct a newly created JBeansReader |
|
JBeansReader(java.io.Reader in,
java.lang.String delim)
Construct a newly created JBeansReader |
|
JBeansReader(java.io.Reader in,
java.lang.String delim,
boolean returnTokens)
Construct a newly created JBeansReader |
Method Summary | |
void |
close()
Close the stream. |
static void |
main(java.lang.String[] args)
Test routine. |
int |
read(char[] cbuf,
int off,
int len)
Read characters into a portion of an array. |
java.lang.String |
read(int len)
Reads the specified numbers of characters and returns as a String. |
static java.lang.String |
read(java.io.Reader reader,
int len)
Reads the specified numbers of characters from the specified Reader and returns as a String. |
boolean |
readBoolean()
Reads a boolean from this data input stream. |
byte |
readByte()
Reads a signed 8-bit value from this data input stream. |
char |
readChar()
Reads a Unicode character from this data input stream. |
static int |
readChars(char[] chars,
java.io.Reader reader,
int len)
Reads the specified numbers of characters from the specified Reader and returns as a String. |
static char[] |
readChars(java.io.Reader reader,
int len)
Reads the specified numbers of characters from the specified Reader and returns as a String. |
double |
readDouble()
Reads a double from this data input stream. |
float |
readFloat()
Reads a float from this data input stream. |
int |
readInt()
Reads a signed 32-bit integer from this data input stream. |
java.lang.String |
readLine()
Read a line of text. |
java.lang.String |
readLine(char commentchar)
Read a line of text. |
java.lang.String |
readLine(java.lang.String commentchars)
Read a line of text. |
long |
readLong()
Reads a signed 64-bit integer from this data input stream. |
short |
readShort()
Reads a signed 16-bit number from this data input stream. |
java.lang.String |
readToken()
Read one token as a string. |
boolean |
ready()
Tell whether this stream is ready to be read. |
Methods inherited from class java.io.Reader |
mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String STREAM_CLOSED
Constructor Detail |
public JBeansReader(java.io.InputStream in, java.lang.String delim, boolean returnTokens)
in
- An InputStream.delim
- the delimiters.returnTokens
- flag indicating whether to return the delimiters
as tokens.public JBeansReader(java.io.InputStream in, java.lang.String delim)
in
- An InputStream.delim
- the delimiters.public JBeansReader(java.io.InputStream in)
in
- An InputStream.public JBeansReader(java.io.Reader in, java.lang.String delim, boolean returnTokens)
in
- A Reader.delim
- the delimiters.returnTokens
- flag indicating whether to return the delimiters
as tokens.public JBeansReader(java.io.Reader in, java.lang.String delim)
in
- A Reader.delim
- the delimiters.public JBeansReader(java.io.Reader in)
in
- A Reader.Method Detail |
public final int read(char[] cbuf, int off, int len) throws java.io.IOException
cbuf
- Destination bufferoff
- Offset at which to start storing characterslen
- Maximum number of characters to read
java.io.IOException
- If an I/O error occurspublic final java.lang.String read(int len) throws java.io.IOException
java.io.IOException
public static final char[] readChars(java.io.Reader reader, int len) throws java.io.IOException
java.io.IOException
public static final int readChars(char[] chars, java.io.Reader reader, int len) throws java.io.IOException
java.io.IOException
public static final java.lang.String read(java.io.Reader reader, int len) throws java.io.IOException
java.io.IOException
public final boolean ready() throws java.io.IOException
java.io.IOException
- If an I/O error occurspublic final void close() throws java.io.IOException
java.io.IOException
- If an I/O error occurspublic final java.lang.String readLine() throws java.io.IOException
java.io.IOException
- If an I/O error occurspublic final java.lang.String readLine(java.lang.String commentchars) throws java.io.IOException
java.io.IOException
- If an I/O error occurspublic final java.lang.String readLine(char commentchar) throws java.io.IOException
java.io.IOException
- If an I/O error occurspublic final java.lang.String readToken() throws java.io.IOException
java.io.IOException
- If an I/O error occurspublic final boolean readBoolean() throws java.io.IOException
boolean
from this data input stream. This
method reads a single byte from the underlying input stream. A
value of 0
represents false
. Any other
value represents true
. This method blocks until
either the byte is read, the end of the stream is detected, or an
exception is thrown.
boolean
value read.
java.io.EOFException
- if this input stream has reached the end.
java.io.IOException
- if an I/O error occurs.public final byte readByte() throws java.io.IOException
b
, where
0 <= b
<= 255, then the
result is:
(byte)(b)
This method blocks until either the byte is read, the end of the stream is detected, or an exception is thrown.
byte
.
java.io.EOFException
- if this input stream has reached the end.
java.io.IOException
- if an I/O error occurs.public final short readShort() throws java.io.IOException
b1
and b2
,
where each of the two values is between 0
and
255
, inclusive, then the result is equal to:
(short)((b1 << 8) | b2)
This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.
java.io.EOFException
- if this input stream reaches the end before
reading two bytes.
java.io.IOException
- if an I/O error occurs.public final char readChar() throws java.io.IOException
b1
and b2
,
where 0 <= b1
,
b1
<= 255, then the result is equal to:
(char)((b1 << 8) | b2)
This method blocks until either the two bytes are read, the end of the stream is detected, or an exception is thrown.
java.io.EOFException
- if this input stream reaches the end before
reading two bytes.
java.io.IOException
- if an I/O error occurs.public final int readInt() throws java.io.IOException
b1
, b2
,
b3
, and b4
, where
0 <= b1
, b2
,
b3
, b4
<= 255, then the
result is equal to:
(b1 << 24) | (b2 << 16) + (b3 << 8) +b4
This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown.
int
.
java.io.EOFException
- if this input stream reaches the end before
reading four bytes.
java.io.IOException
- if an I/O error occurs.public final long readLong() throws java.io.IOException
b1
, b2
,
b3
, b4
, b5
,
b6
, b7
, and b8
, where
0 <= b1, b2, b3, b4, b5, b6, b7, b8 <= 255,
then the result is equal to:
((long)b1 << 56) + ((long)b2 << 48) + ((long)b3 << 40) + ((long)b4 << 32) + ((long)b5 << 24) + (b6 << 16) + (b7 << 8) + b8
This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown.
long
.
java.io.EOFException
- if this input stream reaches the end before
reading eight bytes.
java.io.IOException
- if an I/O error occurs.public final float readFloat() throws java.io.IOException
float
from this data input stream. This
method reads an int
value as if by the
readInt
method and then converts that
int
to a float
using the
intBitsToFloat
method in class Float
.
This method blocks until the four bytes are read, the end of the
stream is detected, or an exception is thrown.
float
.
java.io.EOFException
- if this input stream reaches the end before
reading four bytes.
java.io.IOException
- if an I/O error occurs.public final double readDouble() throws java.io.IOException
double
from this data input stream. This
method reads a long
value as if by the
readLong
method and then converts that
long
to a double
using the
longBitsToDouble
method in class Double
.
This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown.
double
.
java.io.EOFException
- if this input stream reaches the end before
reading eight bytes.
java.io.IOException
- if an I/O error occurs.public static final void main(java.lang.String[] args)
args
- the command line arguments.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |