|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectau.com.zip.cs.IO
public final class IO
Assorted I/O convenience routines.
| Constructor Summary | |
|---|---|
IO()
|
|
| Method Summary | |
|---|---|
static String |
getContLine(LineStackReader r)
Read a line and all subsequent lines commencing with a space or tab. |
static String |
getSloshLine(BufferedReader r)
Read a slosh ('\\') extended line from a BufferedReader,
discarding the sloshes. |
static String |
getSloshLine(BufferedReader r,
boolean keepSlosh)
Read a slosh ('\\') extended line from a BufferedReader,
optionally discarding the sloshes. |
static int |
probe(PushbackReader r)
Return the next characters which would come from a PushbackReader,
which may be EOF. |
static StringBuffer |
readAll(Reader r)
Read all the remaining characters from a Reader
and return them in a single StringBuffer. |
static char |
readChar(Reader r)
Just like Reader.read() except that EOF is an exception
and so we can return a char. |
static int |
readHex1(Reader r)
Read a single hexadecimal numeral from a Reader
and return its hex value. |
static int |
readHex2(Reader r)
Read two hexadecimal numerals from a Reader
and return their value. |
static int |
readHex4(Reader r)
Read four hexadecimal numerals from a Reader
and return their value. |
static StringBuffer |
readTo(PushbackReader r,
String delims)
Read characters from a PushbackReader until one of the delimiters
listed in the String delims is reached. |
static StringBuffer |
readTo(PushbackReader r,
String delims,
StringBuffer b)
Read characters from a PushbackReader until one of the delimiters
listed in the String delims is reached,
appending to the supplied StringBuffer. |
static StringBuffer |
readWord(PushbackReader r)
Read an identifier from a PushbackReader. |
static void |
skipWhite(PushbackReader r)
Skip past any whitespace characters at the start of a PushbackReader. |
static void |
unreadChar(PushbackReader r,
char ch)
Just like PushbackReader.unread(int) except that it only takes chars. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IO()
| Method Detail |
|---|
public static final char readChar(Reader r)
throws IOException
Reader.read() except that EOF is an exception
and so we can return a char.
r - the Reader from which to read
IOException
public static final void unreadChar(PushbackReader r,
char ch)
throws IOException
PushbackReader.unread(int) except that it only takes chars.
It seems that unread(int), which takes an int, transmutes EOF (-1) into
65535, and so although it permits pushing back EOF,
this breaks the stream.
r - the Reader from which to readch - the char to push back
IOException
public static final int probe(PushbackReader r)
throws IOException
PushbackReader,
which may be EOF.
r - the PushbackReader
IOException
public static final StringBuffer readTo(PushbackReader r,
String delims)
throws IOException
PushbackReader until one of the delimiters
listed in the String delims is reached.
The delimiter is left on the Reader.
r - a PushbackReader from which to readdelims - a list of stop characters
StringBuffer containing the characters read
IOException
public static final StringBuffer readTo(PushbackReader r,
String delims,
StringBuffer b)
throws IOException
PushbackReader until one of the delimiters
listed in the String delims is reached,
appending to the supplied StringBuffer.
A new StringBuffer is allocated if the supplied one is null.
The delimiter is left on the Reader.
r - a PushbackReader from which to readdelims - a list of stop charactersb - the StringBuffer
IOException
public static final StringBuffer readWord(PushbackReader r)
throws IOException
PushbackReader.
r - the stream from which to read
StringBuffer holding the word, if any
IOException
public static final int readHex1(Reader r)
throws IOException,
ParseException
Reader
and return its hex value.
r - the stream from which to read
ParseException - thrown when a hexadecimal numeral was found
IOException
public static final int readHex2(Reader r)
throws IOException,
ParseException
Reader
and return their value.
r - the stream from which to read
ParseException - thrown when less than two hexadecimal numerals were found
IOException
public static final int readHex4(Reader r)
throws IOException,
ParseException
Reader
and return their value.
r - the stream from which to read
ParseException - thrown when less than four hexadecimal numerals were found
IOException
public static void skipWhite(PushbackReader r)
throws IOException
PushbackReader.
r - the stream from which to read
IOException
public static String getSloshLine(BufferedReader r)
throws IOException
BufferedReader,
discarding the sloshes.
r - the stream from which to read
null at EOF
IOException
public static String getSloshLine(BufferedReader r,
boolean keepSlosh)
throws IOException
BufferedReader,
optionally discarding the sloshes.
The trailing newline of the last (unsloshed) line collected
is discarded.
r - the stream from which to readkeepSlosh - whether to keep the sloshes
null at EOF
IOException
public static String getContLine(LineStackReader r)
throws IOException
r - the LineStackReader from which to read lines
IOException
public static StringBuffer readAll(Reader r)
throws IOException
Reader
and return them in a single StringBuffer.
r - the stream from which to read
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||