public class FileBackedDataSource extends DataSource
DataSource backed by a File| Constructor and Description |
|---|
FileBackedDataSource(java.io.File file) |
FileBackedDataSource(java.io.File file,
boolean readOnly) |
FileBackedDataSource(java.nio.channels.FileChannel channel,
boolean readOnly) |
FileBackedDataSource(java.io.RandomAccessFile srcFile,
boolean readOnly) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the underlying stream
|
void |
copyTo(java.io.OutputStream stream)
Copies the contents to the specified OutputStream
|
java.nio.channels.FileChannel |
getChannel() |
boolean |
isWriteable() |
java.nio.ByteBuffer |
read(int length,
long position) |
long |
size() |
void |
write(java.nio.ByteBuffer src,
long position) |
public FileBackedDataSource(java.io.File file)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic FileBackedDataSource(java.io.File file,
boolean readOnly)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic FileBackedDataSource(java.io.RandomAccessFile srcFile,
boolean readOnly)
public FileBackedDataSource(java.nio.channels.FileChannel channel,
boolean readOnly)
public boolean isWriteable()
public java.nio.channels.FileChannel getChannel()
public java.nio.ByteBuffer read(int length,
long position)
throws java.io.IOException
read in class DataSourcejava.io.IOExceptionpublic void write(java.nio.ByteBuffer src,
long position)
throws java.io.IOException
write in class DataSourcejava.io.IOExceptionpublic void copyTo(java.io.OutputStream stream)
throws java.io.IOException
DataSourcecopyTo in class DataSourcejava.io.IOExceptionpublic long size()
throws java.io.IOException
size in class DataSourcejava.io.IOExceptionpublic void close()
throws java.io.IOException
DataSourceclose in class DataSourcejava.io.IOExceptionCopyright 2018 The Apache Software Foundation or its licensors, as applicable.