public class FileBackedDataSource extends DataSource implements java.io.Closeable
DataSource
backed by a File
(由文件支持的 POIFS 数据源)
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
(将内容复制到指定的 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
(java.io.FileNotFoundException)
public FileBackedDataSource(java.io.File file, boolean readOnly) throws java.io.FileNotFoundException
java.io.FileNotFoundException
(java.io.FileNotFoundException)
public 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
DataSource
(读入类 DataSource)
java.io.IOException
(java.io.IOException)
public void write(java.nio.ByteBuffer src, long position) throws java.io.IOException
write
in class
DataSource
(写入类 DataSource)
java.io.IOException
(java.io.IOException)
public void copyTo(java.io.OutputStream stream) throws java.io.IOException
DataSource
copyTo
in class
DataSource
(类 DataSource 中的 copyTo)
java.io.IOException
(java.io.IOException)
public long size() throws java.io.IOException
size
in class
DataSource
(类 DataSource 中的大小)
java.io.IOException
(java.io.IOException)
public void releaseBuffer(java.nio.ByteBuffer buffer)
public void close() throws java.io.IOException
DataSource
close
in interface
java.io.Closeable
(在接口 java.io.Closeable 中关闭)
close
in interface
java.lang.AutoCloseable
(在接口 java.lang.AutoCloseable 中关闭)
close
in class
DataSource
(在类 DataSource 中关闭)
java.io.IOException
(java.io.IOException)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.