Class RtfDiskCache

  • All Implemented Interfaces:
    RtfDataCache

    public class RtfDiskCache
    extends java.lang.Object
    implements RtfDataCache
    The RtfFileCache is a RtfDataCache that uses a temporary file to store the rtf document data. Not so fast, but doesn't use any memory (just disk space).
    Version:
    $Revision: 3373 $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.BufferedOutputStream data
      The BufferedOutputStream that stores the cache data.
      private java.io.File tempFile
      The temporary file to store the data in.
    • Constructor Summary

      Constructors 
      Constructor Description
      RtfDiskCache()
      Constructs a RtfFileCache.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.OutputStream getOutputStream()
      Gets the BufferedOutputStream to write to.
      void writeTo​(java.io.OutputStream target)
      Writes the content of the temporary file into the OutputStream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • data

        private final java.io.BufferedOutputStream data
        The BufferedOutputStream that stores the cache data.
      • tempFile

        private final java.io.File tempFile
        The temporary file to store the data in.
    • Constructor Detail

      • RtfDiskCache

        public RtfDiskCache()
                     throws java.io.IOException
        Constructs a RtfFileCache. Creates the temp file.
        Throws:
        java.io.IOException - If the temporary file could not be created.
    • Method Detail

      • getOutputStream

        public java.io.OutputStream getOutputStream()
        Gets the BufferedOutputStream to write to.
        Specified by:
        getOutputStream in interface RtfDataCache
        Returns:
        The OutputStream the RtfDocument can use.
      • writeTo

        public void writeTo​(java.io.OutputStream target)
                     throws java.io.IOException
        Writes the content of the temporary file into the OutputStream.
        Specified by:
        writeTo in interface RtfDataCache
        Parameters:
        target - The OutputStream to write the content into.
        Throws:
        java.io.IOException - If an error occurs reading/writing.