All Packages Class Hierarchy This Package Previous Next Index
Class sdsu.io.ChunkReader
java.lang.Object
|
+----sdsu.io.ChunkReader
- public class ChunkReader
- extends Object
- implements Enumeration
A chunk is any sequence of characters you wish. A chunk could be a
single line, a table, or a complete document. The ChunkWriter
separates chunks with a string separator, called a chunk seperator.
The separator can be any string. The separator is not part of a chunk.
The separator should be selected to insure that it does not occur in
the input as a
part of a chunk, as it will be interpreted as the end of the chunk
not as
part of the chunk. ChunkWriter will return each chunk one at a time.
- Version:
- 0.8 7 January 1998
- Author:
- Roger Whitney
(whitney@cs.sdsu.edu)
-
ChunkReader(Reader, String)
- Create a ChunkReader object with a Reader as an input and the
given separator.
-
ChunkReader(String, String)
- Create a ChunkReader object with a String as an input and the
given separator.
-
eof()
- Returns true if there are more blocks of data in the input.
-
fromFile(String, String)
- Create a ChunkReader object with a file as an input and the
given separator.
-
hasMoreElements()
- Returns true if there are more blocks of data in the input.
-
nextElement()
- Returns the next block of data.
-
readChunk()
- Returns the next block of data.
-
setSeparator(String)
-
ChunkReader
public ChunkReader(Reader in,
String separator)
- Create a ChunkReader object with a Reader as an input and the
given separator. This class does not buffer the reader for you.
ChunkReader
public ChunkReader(String input,
String separator)
- Create a ChunkReader object with a String as an input and the
given separator.
fromFile
public static ChunkReader fromFile(String fileName,
String separator) throws FileNotFoundException
- Create a ChunkReader object with a file as an input and the
given separator. File IO will be buffered for you.
- Throws: FileNotFoundException
- thrown if fileName is not
valid file name.
setSeparator
public void setSeparator(String newSeparator)
eof
public boolean eof()
- Returns true if there are more blocks of data in the input.
hasMoreElements
public boolean hasMoreElements()
- Returns true if there are more blocks of data in the input.
readChunk
public Object readChunk()
- Returns the next block of data.
- Throws: NoSuchElementException
- if there are no blocks of
data left.
nextElement
public Object nextElement()
- Returns the next block of data.
- Throws: NoSuchElementException
- if there are no blocks of
data left.
All Packages Class Hierarchy This Package Previous Next Index