cynosurex.io
Class TemporaryStorage

java.lang.Object
  extended by cynosurex.io.TemporaryStorage
All Implemented Interfaces:
cynosurex.internal.AuthorCommon, cynosurex.internal.CommonInterface, cynosurex.internal.CompanyCommon

public class TemporaryStorage
extends java.lang.Object
implements cynosurex.internal.CommonInterface

This class provides tools to deal with temporary files and directories. If you create temporary files and directory by instantiating this class, it will also manage the temporary file/directory for you. It will delete all temporary file when it goes out of scope.

Version:
1.0
Author:
Chieh Cheng

Field Summary
static boolean DIRECTORY
           
static boolean FILE
           
 
Fields inherited from interface cynosurex.internal.CommonInterface
copyright, copyrightYears, notice, program, version
 
Fields inherited from interface cynosurex.internal.AuthorCommon
author, copyrightSymbol, noticeMsg, rights
 
Fields inherited from interface cynosurex.internal.CompanyCommon
company, email, website
 
Constructor Summary
TemporaryStorage(boolean type)
          Constructor
TemporaryStorage(java.lang.String prefix, boolean type)
          Constructor
 
Method Summary
 void cleanUp()
          Cleans up the temporary file or directory.
protected  void finalize()
           
 java.io.File getPath()
          This method returns the File entity to the temporary path.
 java.lang.String getPrefix()
          This method returns the prefix for the temporary file or directory.
static java.lang.String getSystemTempDir()
          Gets the operating system temporary directory.
 boolean getType()
          This method provides whether this is a temporary file or a temporary directory.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE

public static final boolean FILE
See Also:
Constant Field Values

DIRECTORY

public static final boolean DIRECTORY
See Also:
Constant Field Values
Constructor Detail

TemporaryStorage

public TemporaryStorage(boolean type)
                 throws java.io.IOException
Constructor

Throws:
java.io.IOException

TemporaryStorage

public TemporaryStorage(java.lang.String prefix,
                        boolean type)
                 throws java.io.IOException
Constructor

Throws:
java.io.IOException
Method Detail

cleanUp

public void cleanUp()
Cleans up the temporary file or directory. You should call this method after you are done with the temporary file or directory.


finalize

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

getPath

public java.io.File getPath()
This method returns the File entity to the temporary path.


getPrefix

public java.lang.String getPrefix()
This method returns the prefix for the temporary file or directory.


getSystemTempDir

public static java.lang.String getSystemTempDir()
Gets the operating system temporary directory.


getType

public boolean getType()
This method provides whether this is a temporary file or a temporary directory.