org.faceless.pdf2
Interface Cache.Entry

Enclosing interface:
Cache

public static interface Cache.Entry

Represents a single entry in the Cache. Each Entry can be read from or written to until the close() method is called, at which point no further writes can be made


Method Summary
 Cache.Entry cloneEntry()
          Create and return a clone of this entry.
 void close()
          Close the Entry.
 BackedInputStream getInputStream()
          Return an InputStream to read from this Entry.
 OutputStream getOutputStream()
          Return an OutputStream to write to this Entry.
 int size()
          Return the size of this Entries buffer in bytes
 void writeTo(OutputStream out)
          Write the entire contents of this Entry to the specified OutputStream.
 

Method Detail

getOutputStream

OutputStream getOutputStream()
Return an OutputStream to write to this Entry. Writes to the OutputStream don't have to be synchronised as it's assumed that only one thread will write to one item at a time. This method will be called repeatedly for the same Entry, and it's essential that the same object is returned each time. No further calls will be made to this method after close() has been called.


getInputStream

BackedInputStream getInputStream()
Return an InputStream to read from this Entry. A new InputStream should be returned every time this method is called, as it may be called more than once in different threads (when reusing an image across threads, for example). Unless the stream is returned directly to the user (as in the PDFSound.getStream() method), this stream will be closed by the library.


writeTo

void writeTo(OutputStream out)
             throws IOException
Write the entire contents of this Entry to the specified OutputStream.

Throws:
IOException

size

int size()
Return the size of this Entries buffer in bytes


cloneEntry

Cache.Entry cloneEntry()
Create and return a clone of this entry. This may be called after the close() method, although as no further writes are possible after that stage there is no need to clone the underlying buffer.


close

void close()
Close the Entry. After this point no further data will be written to the OutputStream, and the buffer can be written to secondary memory if space is tight.



Copyright © 2001-2012 Big Faceless Organization