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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()
      Close the Entry.
      BackedInputStream getInputStream()
      Return an InputStream to read from this Entry.
      java.io.OutputStream getOutputStream()
      Return an OutputStream to write to this Entry.
      int size()
      Return the size of this Entries buffer in bytes
      void writeTo​(java.io.OutputStream out)
      Write the entire contents of this Entry to the specified OutputStream.
    • Method Detail

      • getOutputStream

        java.io.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 PDFAbstractMap.getStream(java.lang.String) method), this stream will be closed by the library.
      • writeTo

        void writeTo​(java.io.OutputStream out)
              throws java.io.IOException
        Write the entire contents of this Entry to the specified OutputStream.
        Throws:
        java.io.IOException
      • size

        int size()
        Return the size of this Entries buffer in bytes
      • 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.