JPedal Java PDF library 4.70b22 API Documentation - http://www.jpedal.org

org.jpedal.io
Class ObjectStore

java.lang.Object
  extended by org.jpedal.io.ObjectStore

public class ObjectStore
extends java.lang.Object

set of methods to save/load objects to keep memory usage to a minimum by spooling images to disk Also includes ancillary method to store a filename - LogWriter is my logging class - Several methods are very similar and I should recode my code to use a common method for the RGB conversion Converted to avoid threading issues, if this causes any problems, please raise them in our forums, http://www.jpedal.org/support.php


Field Summary
 java.lang.String fullFileName
           
static java.lang.Integer IMAGE_COLORSPACE
          paramter stored on cached images
static java.lang.Integer IMAGE_HEIGHT
          parameter stored on cached images
static java.lang.Integer IMAGE_MASKCOL
          paramter stored on cached images
static java.lang.Integer IMAGE_pX
          parameter stored on cached images
static java.lang.Integer IMAGE_pY
          parameter stored on cached images
static java.lang.Integer IMAGE_WIDTH
          parameter stored on cached images
static boolean isMultiThreaded
          do not set unless you know what you are doing
static java.lang.String multiThreaded_root_dir
           
static java.lang.String temp_dir
          temp storage for the images so they are not held in memory
static long time
          period after which we assumes files must be dead (ie from crashed instance) default is four hour image time
static boolean verifyFilesSaved
          flag to verify if temp dir created and throw RuntimeException if not
 
Constructor Summary
ObjectStore()
          ObjectStore - Converted for Threading purposes - To fix any errors please try replacing ObjectStore with {your instance of PdfDecoder}.getObjectStore() -
 
Method Summary
static void cachePage(java.lang.Integer key, org.jpedal.render.DynamicVectorRenderer currentDisplay)
           
static void cachePageAsBytes(java.lang.String key, byte[] bytes)
           
static void copy(java.io.BufferedInputStream from, java.io.BufferedOutputStream to)
           
static void copy(java.lang.String source, java.lang.String destination)
          save copy Converted to avoid threading issues, if this causes any problems, please raise them in our forums, http://www.jpedal.org/
static void copyCMYKimages(java.lang.String target_dir)
          copies cmyk raw data from cmyk temp dir to target directory
static java.io.File createTempFile(java.lang.String filename)
           
 void finalize()
           
 void flush()
          routine to remove all objects from temp store
static void flushPages()
          delete all cached pages
static org.jpedal.render.DynamicVectorRenderer getCachedPage(java.lang.Integer key)
          note may not actually be written by JVM immediately so do not rely for fast actions
static byte[] getCachedPageAsBytes(java.lang.String key)
           
 java.lang.String getCurrentFilename()
          get the file name - we use this as a get in our file repository - Note this method is not part of the API and is not guaranteed to be in future versions of JPedal -
 java.lang.String getCurrentFilepath()
          get the file path for current PDF Note this method is not part of the API and is not guaranteed to be in future versions of JPedal -
 java.lang.String getFileForCachedImage(java.lang.String current_image)
           
 java.lang.String getImageType(java.lang.String current_image)
          get type of image used to store graphic
 java.lang.String getKey()
           
 byte[] getRawImageData(java.lang.String i)
          retrieve byte data on disk
 java.lang.Object getRawImageDataParameter(java.lang.String imageID, java.lang.Integer key)
          return parameter stored for image or null
 void init(java.lang.String current_key)
          init method to pass in values for temp directory, unique key, etc so program knows where to store files
 boolean isImageCached(java.lang.String current_image)
          see if image already saved to disk (ie multiple pages)
 boolean isRawImageDataSaved(java.lang.String number)
          see if image data saved
 java.awt.image.BufferedImage loadStoredImage(java.lang.String current_image)
          load a image when required and remove from store
static java.lang.String removeIllegalFileNameCharacters(java.lang.String s)
          Remove troublesome characters from temp file names.
 void saveAsCopy(java.lang.String current_image, java.lang.String destination)
          save copy
 boolean saveRawCMYKImage(byte[] image_data, java.lang.String name)
          save raw CMYK data in CMYK directory - We extract the DCT encoded image stream and save as a file with a .jpeg ending so we have the raw image - This works for DeviceCMYK -
 void saveRawImageData(java.lang.String pageImgCount, byte[] bytes, int w, int h, int pX, int pY, byte[] maskCol, int colorSpaceID)
           
 boolean saveStoredImage(java.lang.String current_image, java.awt.image.BufferedImage image, boolean file_name_is_path, boolean save_unclipped, java.lang.String type)
          save buffered image as JPEG or tif
 void setFileToDeleteOnFlush(java.lang.String rawFileName)
          add file to list we delete on flush so we can clear any temp files we create
 void storeFileName(java.lang.String name)
          store filename as a key we can use to differentiate images,etc - Note this method is not part of the API and is not guaranteed to be in future versions of JPedal -
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verifyFilesSaved

public static final boolean verifyFilesSaved
flag to verify if temp dir created and throw RuntimeException if not

See Also:
Constant Field Values

isMultiThreaded

public static final boolean isMultiThreaded
do not set unless you know what you are doing

See Also:
Constant Field Values

temp_dir

public static java.lang.String temp_dir
temp storage for the images so they are not held in memory


multiThreaded_root_dir

public static final java.lang.String multiThreaded_root_dir

IMAGE_WIDTH

public static final java.lang.Integer IMAGE_WIDTH
parameter stored on cached images


IMAGE_HEIGHT

public static final java.lang.Integer IMAGE_HEIGHT
parameter stored on cached images


IMAGE_pX

public static final java.lang.Integer IMAGE_pX
parameter stored on cached images


IMAGE_pY

public static final java.lang.Integer IMAGE_pY
parameter stored on cached images


IMAGE_MASKCOL

public static final java.lang.Integer IMAGE_MASKCOL
paramter stored on cached images


IMAGE_COLORSPACE

public static final java.lang.Integer IMAGE_COLORSPACE
paramter stored on cached images


time

public static final long time
period after which we assumes files must be dead (ie from crashed instance) default is four hour image time

See Also:
Constant Field Values

fullFileName

public java.lang.String fullFileName
Constructor Detail

ObjectStore

public ObjectStore()
ObjectStore - Converted for Threading purposes - To fix any errors please try replacing ObjectStore with {your instance of PdfDecoder}.getObjectStore() -

Method Detail

getCurrentFilename

public java.lang.String getCurrentFilename()
get the file name - we use this as a get in our file repository - Note this method is not part of the API and is not guaranteed to be in future versions of JPedal -


getCurrentFilepath

public java.lang.String getCurrentFilepath()
get the file path for current PDF Note this method is not part of the API and is not guaranteed to be in future versions of JPedal -


storeFileName

public final void storeFileName(java.lang.String name)
store filename as a key we can use to differentiate images,etc - Note this method is not part of the API and is not guaranteed to be in future versions of JPedal -


saveRawCMYKImage

public boolean saveRawCMYKImage(byte[] image_data,
                                java.lang.String name)
save raw CMYK data in CMYK directory - We extract the DCT encoded image stream and save as a file with a .jpeg ending so we have the raw image - This works for DeviceCMYK -


saveStoredImage

public final boolean saveStoredImage(java.lang.String current_image,
                                     java.awt.image.BufferedImage image,
                                     boolean file_name_is_path,
                                     boolean save_unclipped,
                                     java.lang.String type)
save buffered image as JPEG or tif


getImageType

public final java.lang.String getImageType(java.lang.String current_image)
get type of image used to store graphic


init

public final void init(java.lang.String current_key)
init method to pass in values for temp directory, unique key, etc so program knows where to store files


loadStoredImage

public final java.awt.image.BufferedImage loadStoredImage(java.lang.String current_image)
load a image when required and remove from store


isImageCached

public final boolean isImageCached(java.lang.String current_image)
see if image already saved to disk (ie multiple pages)


flush

public final void flush()
routine to remove all objects from temp store


copyCMYKimages

public static void copyCMYKimages(java.lang.String target_dir)
copies cmyk raw data from cmyk temp dir to target directory


getFileForCachedImage

public java.lang.String getFileForCachedImage(java.lang.String current_image)

saveAsCopy

public final void saveAsCopy(java.lang.String current_image,
                             java.lang.String destination)
save copy


copy

public static void copy(java.lang.String source,
                        java.lang.String destination)
save copy Converted to avoid threading issues, if this causes any problems, please raise them in our forums, http://www.jpedal.org/


copy

public static void copy(java.io.BufferedInputStream from,
                        java.io.BufferedOutputStream to)

flushPages

public static void flushPages()
delete all cached pages


finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

getCachedPage

public static org.jpedal.render.DynamicVectorRenderer getCachedPage(java.lang.Integer key)
note may not actually be written by JVM immediately so do not rely for fast actions


cachePage

public static void cachePage(java.lang.Integer key,
                             org.jpedal.render.DynamicVectorRenderer currentDisplay)

getCachedPageAsBytes

public static byte[] getCachedPageAsBytes(java.lang.String key)

cachePageAsBytes

public static void cachePageAsBytes(java.lang.String key,
                                    byte[] bytes)

saveRawImageData

public void saveRawImageData(java.lang.String pageImgCount,
                             byte[] bytes,
                             int w,
                             int h,
                             int pX,
                             int pY,
                             byte[] maskCol,
                             int colorSpaceID)

isRawImageDataSaved

public boolean isRawImageDataSaved(java.lang.String number)
see if image data saved


getRawImageData

public byte[] getRawImageData(java.lang.String i)
retrieve byte data on disk


getRawImageDataParameter

public java.lang.Object getRawImageDataParameter(java.lang.String imageID,
                                                 java.lang.Integer key)
return parameter stored for image or null


createTempFile

public static java.io.File createTempFile(java.lang.String filename)
                                   throws java.io.IOException
Throws:
java.io.IOException

removeIllegalFileNameCharacters

public static java.lang.String removeIllegalFileNameCharacters(java.lang.String s)
Remove troublesome characters from temp file names.

Parameters:
s -
Returns:

setFileToDeleteOnFlush

public void setFileToDeleteOnFlush(java.lang.String rawFileName)
add file to list we delete on flush so we can clear any temp files we create

Parameters:
rawFileName -

getKey

public java.lang.String getKey()

JPedal Java PDF library 4.70b22 API Documentation - http://www.jpedal.org

JPedal Java PDF library 4.70b22 API Documentation - http://www.jpedal.org