public class FileBackedDataSource extends DataSource implements java.io.Closeable
DataSource
backed by a FileConstructor and Description |
---|
FileBackedDataSource(java.io.File file) |
FileBackedDataSource(java.io.File file,
boolean readOnly) |
FileBackedDataSource(java.nio.channels.FileChannel channel,
boolean readOnly) |
FileBackedDataSource(java.nio.channels.FileChannel channel,
boolean readOnly,
boolean closeChannelOnClose) |
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) |
void |
releaseBuffer(java.nio.ByteBuffer buffer) |
long |
size() |
void |
write(java.nio.ByteBuffer src,
long position) |
public FileBackedDataSource(java.io.File file) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public FileBackedDataSource(java.io.File file, boolean readOnly) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public FileBackedDataSource(java.io.RandomAccessFile srcFile, boolean readOnly)
public FileBackedDataSource(java.nio.channels.FileChannel channel, boolean readOnly)
public FileBackedDataSource(java.nio.channels.FileChannel channel, boolean readOnly, boolean closeChannelOnClose)
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 DataSource
java.io.IOException
public void write(java.nio.ByteBuffer src, long position) throws java.io.IOException
write
in class DataSource
java.io.IOException
public void copyTo(java.io.OutputStream stream) throws java.io.IOException
DataSource
copyTo
in class DataSource
java.io.IOException
public long size() throws java.io.IOException
size
in class DataSource
java.io.IOException
public void releaseBuffer(java.nio.ByteBuffer buffer)
public void close() throws java.io.IOException
DataSource
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class DataSource
java.io.IOException
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.