|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.etymon.pjx.PdfInputFile
public class PdfInputFile
Provides low-level methods for reading portions of a PDF document.
PdfReader
accesses PDF documents through the
PdfInput
interface, which is implemented by this
class. The portions of the document are read from the file system
as they are requested, which reduces memory consumption as compared
to PdfInputBuffer
but is a bit slower.
This class is synchronized; however, note that since it acts as a
wrapper around a file that is kept open, it is the calling method's
responsibility to ensure that the file is not modified externally
to this class. If that is a problem, use PdfInputBuffer.PdfInputBuffer(File)
, which reads the entire file
into memory and closes it immediately.
Field Summary | |
---|---|
protected java.nio.channels.FileChannel |
_fileChannel
The file channel associated with the PDF document. |
protected long |
_length
The length of the input file. |
protected java.lang.String |
_name
The input file name. |
protected java.io.RandomAccessFile |
_randomAccessFile
The random access file containing the PDF document. |
Constructor Summary | |
---|---|
PdfInputFile(java.io.File pdfFile)
Constructs a PDF input source based on a specified file. |
Method Summary | |
---|---|
void |
close()
Closes the PDF document and releases any system resources associated with it. |
long |
getLength()
Returns the length of the PDF document. |
java.lang.String |
getName()
Returns a name string associated of the PDF document. |
java.nio.ByteBuffer |
readBytes(long start,
long end)
Returns a specified portion of a PDF document as a ByteBuffer . |
java.nio.CharBuffer |
readChars(long start,
long end)
Returns a specified portion of a PDF document as a CharBuffer . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.nio.channels.FileChannel _fileChannel
protected long _length
protected java.lang.String _name
protected java.io.RandomAccessFile _randomAccessFile
Constructor Detail |
---|
public PdfInputFile(java.io.File pdfFile) throws java.io.IOException
pdfFile
- the source file.
java.io.IOException
Method Detail |
---|
public void close() throws java.io.IOException
java.io.IOException
public long getLength()
PdfInput
getLength
in interface PdfInput
public java.nio.ByteBuffer readBytes(long start, long end) throws java.io.IOException
PdfInput
ByteBuffer
.
readBytes
in interface PdfInput
start
- the offset position of the first byte to read.end
- the offset position at which to stop reading.
(The byte at this offset is not included.)
java.io.IOException
public java.nio.CharBuffer readChars(long start, long end) throws java.io.IOException
PdfInput
CharBuffer
.
readChars
in interface PdfInput
start
- the offset position of the first byte to read.end
- the offset position at which to stop reading.
(The byte at this offset is not included.)
java.io.IOException
public java.lang.String getName()
PdfInput
getName
in interface PdfInput
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |