net.sf.jasperreports.engine.fill

## Class JRFileVirtualizer

- java.lang.Object
- - net.sf.jasperreports.engine.fill.JRAbstractLRUVirtualizer
  - - net.sf.jasperreports.engine.fill.JRFileVirtualizer

- All Implemented Interfaces:
    JRVirtualizer

      public class JRFileVirtualizer
      extends JRAbstractLRUVirtualizer

  Virtualizes data to the filesystem. When this object is finalized, it removes the swap files it makes. The virtualized objects have references to this object, so finalization does not occur until this object and the objects using it are only weakly referenced.
  Version:
    $Id: JRFileVirtualizer.java 5878 2013-01-07 20:23:13Z teodord $
  Author:
    John Bindel

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.sf.jasperreports.engine.fill.JRAbstractLRUVirtualizer

      `JRAbstractLRUVirtualizer.Cache, JRAbstractLRUVirtualizer.CacheReference`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `PROPERTY_TEMP_FILES_SET_DELETE_ON_EXIT` Property used to decide whether `deleteOnExit` should be requested for temporary files created by the virtualizer.

    - ### Fields inherited from class net.sf.jasperreports.engine.fill.JRAbstractLRUVirtualizer

      `lastObjectMap, lastObjectRef, lastObjectSet, serializer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JRFileVirtualizer(int maxSize)` Uses the process's working directory as the location to store files.
    `JRFileVirtualizer(int maxSize, java.lang.String directory)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cleanup()` Called when we are done with the virtualizer and wish to cleanup any resources it has.
    `protected void` | `dispose(java.lang.String virtualId)` Removes the external data associated with a virtualizable object.
    `protected void` | `pageIn(JRVirtualizable o)` Reads a virtualizable object's data from an external storage.
    `protected void` | `pageOut(JRVirtualizable o)` Writes a virtualizable object's data to an external storage.

    - ### Methods inherited from class net.sf.jasperreports.engine.fill.JRAbstractLRUVirtualizer

      `clearData, deregisterObject, dispose, disposeAll, evict, finalize, isEvictable, isPagedOut, isPagedOutAndTouch, isReadOnly, isReadOnly, lastObject, readData, registerObject, requestData, reset, setLastObject, setReadOnly, touch, virtualizeData, writeData`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PROPERTY_TEMP_FILES_SET_DELETE_ON_EXIT

          public static final java.lang.String PROPERTY_TEMP_FILES_SET_DELETE_ON_EXIT

      Property used to decide whether `deleteOnExit` should be requested for temporary files created by the virtualizer.

      Calling `File.deleteOnExit()` will accumulate JVM process memory (see this bug), and this should abviously be avoided in long-running applications.

      Temporary files will be deleted by explicitly calling `cleanup()` or from the virtualizer `finalize()` method.

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JRFileVirtualizer

          public JRFileVirtualizer(int maxSize)

      Uses the process's working directory as the location to store files.
      Parameters:
        `maxSize` - the maximum size (in JRVirtualizable objects) of the paged in cache.

    - #### JRFileVirtualizer

          public JRFileVirtualizer(int maxSize,
                           java.lang.String directory)

      Parameters:
        `maxSize` - the maximum size (in JRVirtualizable objects) of the paged in cache.
        `directory` - the base directory in the filesystem where the paged out data is to be stored

  - ### Method Detail

    - #### pageOut

          protected void pageOut(JRVirtualizable o)
                          throws java.io.IOException

      Description copied from class: `JRAbstractLRUVirtualizer`
      Writes a virtualizable object's data to an external storage.
      Specified by:
        `pageOut` in class `JRAbstractLRUVirtualizer`
      Parameters:
        `o` - a virtualizable object
      Throws:
        `java.io.IOException`

    - #### pageIn

          protected void pageIn(JRVirtualizable o)
                         throws java.io.IOException

      Description copied from class: `JRAbstractLRUVirtualizer`
      Reads a virtualizable object's data from an external storage.
      Specified by:
        `pageIn` in class `JRAbstractLRUVirtualizer`
      Parameters:
        `o` - a virtualizable object
      Throws:
        `java.io.IOException`

    - #### dispose

          protected void dispose(java.lang.String virtualId)

      Description copied from class: `JRAbstractLRUVirtualizer`
      Removes the external data associated with a virtualizable object.
      Specified by:
        `dispose` in class `JRAbstractLRUVirtualizer`
      Parameters:
        `virtualId` - the ID of the virtualizable object

    - #### cleanup

          public void cleanup()

      Called when we are done with the virtualizer and wish to cleanup any resources it has.

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com