Package com.compomics.util.io.flat
Interface SimpleFileReader
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
SimpleGzReader,SimpleTextReader
Interface for file readers.
- Author:
- Marc Vaudel
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static SimpleFileReadergetFileReader(File file) Returns a file reader, text or gz, according to the extension of the file.doubleReturns the progress reading the file in percent.Returns the underlying reader.intread(char[] buffer) Reads characters into an array.intread(char[] buffer, int offset, int length) Reads characters into an array.readLine()Reads a line of the file.
-
Method Details
-
getFileReader
Returns a file reader, text or gz, according to the extension of the file.- Parameters:
file- the file- Returns:
- a file reader
-
readLine
String readLine()Reads a line of the file.- Returns:
- a line of the file
-
read
int read(char[] buffer) Reads characters into an array.- Parameters:
buffer- The destination buffer.- Returns:
- The number of characters read, -1 if the end of the stream has been reached.
-
read
int read(char[] buffer, int offset, int length) Reads characters into an array.- Parameters:
buffer- The destination buffer.offset- The offset at which to start storing characterslength- The maximum number of characters to read- Returns:
- The number of characters read, -1 if the end of the stream has been reached.
-
getReader
Reader getReader()Returns the underlying reader.- Returns:
- The underlying reader.
-
getProgressInPercent
double getProgressInPercent()Returns the progress reading the file in percent.- Returns:
- The progress reading the file in percent.
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-