public class DelimitedReader extends Object implements Closeable
Constructor and Description |
---|
DelimitedReader(File file,
char delimiter)
Open a file and prepare to read it using the specified
delimiter character.
|
DelimitedReader(InputStream ins,
char delimiter)
Prepares to read an input stream using the specified
delimiter character.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
CLoses all open IO channels.
|
int |
getLineNumber()
Gets the current position in the file as a line number.
|
List<String> |
readStrings()
Read a row of strings from the file
|
int |
readStrings(List<String> sList)
Read a row of strings from the file, storing the results in
a reusable list.
|
public DelimitedReader(File file, char delimiter) throws IOException
file
- a valid file referencedelimiter
- a delimiter characterIOException
- in the event of an unsuccessful I/O operationpublic DelimitedReader(InputStream ins, char delimiter) throws IOException
ins
- a valid input stream referencedelimiter
- a delimiter characterIOException
- in the event of an unsuccessful I/O operationpublic List<String> readStrings() throws IOException
IOException
- in the event of an unsuccessful I/O operation.public int readStrings(List<String> sList) throws IOException
sList
- a list in which the strings will be storedIOException
- in the event of an unsuccessful I/O operation.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- in the event of an unexpected I/O condition.public int getLineNumber()
Copyright © 2021. All rights reserved.