Class FileBackedDataSource
java.lang.Object
org.docx4j.org.apache.poi.poifs.nio.DataSource
org.docx4j.org.apache.poi.poifs.nio.FileBackedDataSource
public class FileBackedDataSource extends DataSource
A POIFS
DataSource backed by a File-
Constructor Summary
Constructors Constructor Description FileBackedDataSource(java.io.File file)FileBackedDataSource(java.io.File file, boolean readOnly)FileBackedDataSource(java.io.RandomAccessFile srcFile, boolean readOnly)FileBackedDataSource(java.nio.channels.FileChannel channel, boolean readOnly) -
Method Summary
Modifier and Type Method Description voidclose()Close the underlying streamvoidcopyTo(java.io.OutputStream stream)Copies the contents to the specified OutputStreamjava.nio.channels.FileChannelgetChannel()booleanisWriteable()java.nio.ByteBufferread(int length, long position)longsize()voidwrite(java.nio.ByteBuffer src, long position)
-
Constructor Details
-
FileBackedDataSource
public FileBackedDataSource(java.io.File file) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
FileBackedDataSource
public FileBackedDataSource(java.io.File file, boolean readOnly) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
FileBackedDataSource
public FileBackedDataSource(java.io.RandomAccessFile srcFile, boolean readOnly) -
FileBackedDataSource
public FileBackedDataSource(java.nio.channels.FileChannel channel, boolean readOnly)
-
-
Method Details
-
isWriteable
public boolean isWriteable() -
getChannel
public java.nio.channels.FileChannel getChannel() -
read
public java.nio.ByteBuffer read(int length, long position) throws java.io.IOException- Specified by:
readin classDataSource- Throws:
java.io.IOException
-
write
public void write(java.nio.ByteBuffer src, long position) throws java.io.IOException- Specified by:
writein classDataSource- Throws:
java.io.IOException
-
copyTo
public void copyTo(java.io.OutputStream stream) throws java.io.IOExceptionDescription copied from class:DataSourceCopies the contents to the specified OutputStream- Specified by:
copyToin classDataSource- Throws:
java.io.IOException
-
size
public long size() throws java.io.IOException- Specified by:
sizein classDataSource- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionDescription copied from class:DataSourceClose the underlying stream- Specified by:
closein classDataSource- Throws:
java.io.IOException
-