public class RandomAccessFileReader
extends java.io.Reader
| Modifier and Type | Class and Description |
|---|---|
static class |
RandomAccessFileReader.MyBufferedReader |
| Modifier and Type | Field and Description |
|---|---|
protected java.nio.charset.Charset |
charset |
protected long |
currentPosition |
static java.util.function.Predicate<java.lang.String> |
FILTER_NONE |
protected static int |
INDEX_HEADER_FILESIZE |
protected static int |
INDEX_HEADER_INDEXCREATIONCOST |
protected long |
lastModified |
protected static int |
MAX_BUFFER_FOR_LINE |
protected java.io.RandomAccessFile |
raf |
protected java.io.Reader |
reader |
| Constructor and Description |
|---|
RandomAccessFileReader(java.io.File f,
java.nio.charset.Charset charset) |
RandomAccessFileReader(java.io.File f,
java.lang.String charsetName) |
RandomAccessFileReader(java.io.RandomAccessFile raf,
java.nio.charset.Charset charset) |
RandomAccessFileReader(java.io.RandomAccessFile raf,
java.lang.String charsetName) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
countLines(java.util.function.Predicate<java.lang.String> filter,
MutableInt maxLineLen,
SimpleTaskStatus status) |
long |
countLines(java.util.function.Predicate<java.lang.String> filter,
SimpleTaskStatus status) |
RandomAccessFileIndex |
createIndexOfLines(java.io.File index,
boolean safe,
java.util.function.Predicate<java.lang.String> filter,
SimpleTaskStatus status) |
RandomAccessFileIndex |
createIndexOfLines(java.io.File index,
boolean safe,
java.util.function.Predicate<java.lang.String> filter,
SimpleTaskStatus status,
java.util.function.Function<java.io.BufferedReader,java.lang.Integer> numberOfLines) |
RandomAccessFileIndex |
createIndexOfLines(java.io.File index,
java.util.function.Predicate<java.lang.String> filter,
SimpleTaskStatus status) |
RandomAccessFileIndex |
createOrOpenIndexOfLines(java.io.File index,
boolean safe,
java.util.function.Predicate<java.lang.String> filter,
SimpleTaskStatus status) |
RandomAccessFileIndex |
createOrOpenIndexOfLines(java.io.File index,
boolean safe,
java.util.function.Predicate<java.lang.String> filter,
SimpleTaskStatus status,
java.util.function.Function<java.io.BufferedReader,java.lang.Integer> numberOfLines) |
RandomAccessFileIndex |
createOrOpenIndexOfLines(java.io.File index,
java.util.function.Predicate<java.lang.String> filter,
SimpleTaskStatus status) |
protected void |
createReader() |
java.nio.charset.Charset |
getCharset() |
long |
getCurrentPosition() |
long |
getFilePointer() |
long |
getLastLinesIndexCreationCost(RandomAccessFileIndex index) |
boolean |
isRecomendedTheRecreationOfTheLinesIndex(java.io.File index) |
static void |
main(java.lang.String[] args) |
int |
read(char[] cbuf,
int off,
int len) |
java.lang.String |
readLine() |
void |
rewind() |
void |
seek(long position) |
public static final java.util.function.Predicate<java.lang.String> FILTER_NONE
protected static final int INDEX_HEADER_FILESIZE
protected static final int INDEX_HEADER_INDEXCREATIONCOST
protected static final int MAX_BUFFER_FOR_LINE
protected java.io.RandomAccessFile raf
protected java.io.Reader reader
protected long currentPosition
protected final java.nio.charset.Charset charset
protected long lastModified
public RandomAccessFileReader(java.io.File f,
java.lang.String charsetName)
throws java.io.IOException
java.io.IOExceptionpublic RandomAccessFileReader(java.io.File f,
java.nio.charset.Charset charset)
throws java.io.IOException
java.io.IOExceptionpublic RandomAccessFileReader(java.io.RandomAccessFile raf,
java.lang.String charsetName)
throws java.io.IOException
java.io.IOExceptionpublic RandomAccessFileReader(java.io.RandomAccessFile raf,
java.nio.charset.Charset charset)
throws java.io.IOException
java.io.IOExceptionpublic java.nio.charset.Charset getCharset()
public int read(char[] cbuf,
int off,
int len)
throws java.io.IOException
read in class java.io.Readerjava.io.IOExceptionprotected void createReader()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Readerjava.io.IOExceptionpublic long getFilePointer()
throws java.io.IOException
java.io.IOExceptionpublic long getCurrentPosition()
public void rewind()
throws java.io.IOException
java.io.IOExceptionpublic void seek(long position)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String readLine()
throws java.io.IOException
java.io.IOExceptionpublic long countLines(java.util.function.Predicate<java.lang.String> filter,
SimpleTaskStatus status)
throws java.io.IOException
java.io.IOExceptionpublic long countLines(java.util.function.Predicate<java.lang.String> filter,
MutableInt maxLineLen,
SimpleTaskStatus status)
throws java.io.IOException
java.io.IOExceptionpublic boolean isRecomendedTheRecreationOfTheLinesIndex(java.io.File index)
public RandomAccessFileIndex createOrOpenIndexOfLines(java.io.File index, java.util.function.Predicate<java.lang.String> filter, SimpleTaskStatus status) throws java.io.IOException
java.io.IOExceptionpublic RandomAccessFileIndex createOrOpenIndexOfLines(java.io.File index, boolean safe, java.util.function.Predicate<java.lang.String> filter, SimpleTaskStatus status) throws java.io.IOException
java.io.IOExceptionpublic RandomAccessFileIndex createOrOpenIndexOfLines(java.io.File index, boolean safe, java.util.function.Predicate<java.lang.String> filter, SimpleTaskStatus status, java.util.function.Function<java.io.BufferedReader,java.lang.Integer> numberOfLines) throws java.io.IOException
java.io.IOExceptionpublic RandomAccessFileIndex createIndexOfLines(java.io.File index, java.util.function.Predicate<java.lang.String> filter, SimpleTaskStatus status) throws java.io.IOException
java.io.IOExceptionpublic RandomAccessFileIndex createIndexOfLines(java.io.File index, boolean safe, java.util.function.Predicate<java.lang.String> filter, SimpleTaskStatus status) throws java.io.IOException
java.io.IOExceptionpublic RandomAccessFileIndex createIndexOfLines(java.io.File index, boolean safe, java.util.function.Predicate<java.lang.String> filter, SimpleTaskStatus status, java.util.function.Function<java.io.BufferedReader,java.lang.Integer> numberOfLines) throws java.io.IOException
java.io.IOExceptionpublic long getLastLinesIndexCreationCost(RandomAccessFileIndex index)
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception