Class FileParameter

java.lang.Object
com.aspectran.core.activity.request.FileParameter
Direct Known Subclasses:
CommonsMultipartFileParameter, InMemoryMultipartFileParameter

public class FileParameter extends Object
The Class FileParameter.

Created: 2008. 04. 11 PM 4:19:40

  • Constructor Details

    • FileParameter

      protected FileParameter()
      Instantiates a new FileParameter.
    • FileParameter

      public FileParameter(File file)
      Instantiates a new FileParameter.
      Parameters:
      file - the file
  • Method Details

    • getFile

      public File getFile()
    • getFileName

      public String getFileName()
      Gets the actual name of the file uploaded.
      Returns:
      the actual name of the file uploaded
    • getFileSize

      public long getFileSize()
      Gets the size of the file uploaded.
      Returns:
      the size of the file uploaded
    • getContentType

      public String getContentType()
      Gets the content type of the file.
      Returns:
      the content type of the file
    • getInputStream

      public InputStream getInputStream() throws IOException
      Returns an InputStream object of the file.
      Returns:
      an OutputStream that can be used for storing the contents of the file.
      Throws:
      IOException - if an I/O error has occurred
    • getBytes

      public byte[] getBytes() throws IOException
      Returns the contents of the file in a byte array. Can not use a large array of memory than the JVM Heap deal.
      Returns:
      a byte array
      Throws:
      IOException - if an I/O error has occurred
    • isRefused

      public boolean isRefused()
      Checks if the file is refused.
      Returns:
      true if the file is refused; false otherwise
    • setRefused

      public void setRefused(boolean refused)
      Sets whether the refused file.
      Parameters:
      refused - whether the file is refused or not
    • saveAs

      public File saveAs(File destFile) throws IOException
      Save an uploaded file as a given destination file. If the file already exists in directory the save with a different name.
      Parameters:
      destFile - the destination file
      Returns:
      a saved file
      Throws:
      IOException - if an I/O error has occurred
    • saveAs

      public File saveAs(File destFile, boolean overwrite) throws IOException
      Save a file as a given destination file.
      Parameters:
      destFile - the destination file
      overwrite - whether to overwrite if it already exists
      Returns:
      a saved file
      Throws:
      IOException - if an I/O error has occurred
    • renameTo

      public File renameTo(File destFile) throws IOException
      Throws:
      IOException
    • renameTo

      public File renameTo(File destFile, boolean overwrite) throws IOException
      Throws:
      IOException
    • determineDestinationFile

      protected File determineDestinationFile(File destFile, boolean overwrite) throws IOException
      Throws:
      IOException
    • getSavedFile

      public File getSavedFile()
      Returns the saved file.
      Returns:
      the saved file
    • setSavedFile

      protected void setSavedFile(File savedFile)
    • releaseSavedFile

      protected void releaseSavedFile()
    • delete

      public void delete()
      Delete a file.
    • rollback

      public void rollback()
      If the saved file exists, delete it.
    • release

      public void release()
      Sets the access permission that allow write operations on the file associated with this FileParameter.
    • toString

      public String toString()
      Overrides:
      toString in class Object