Apache Struts API Documentation: Class DiskFile

Apache Struts API


org.apache.struts.upload Class DiskFile

java.lang.Object
  |
  +--org.apache.struts.upload.DiskFile
All Implemented Interfaces:
FormFile

Deprecated. Use the Commons FileUpload based multipart handler instead. This class will be removed after Struts 1.2.

public class DiskFile
extends java.lang.Object
implements FormFile


Field Summary
protected  java.lang.String contentType
          Deprecated. The content type of the file
protected  java.lang.String fileName
          Deprecated. The name of the file
protected  java.lang.String filePath
          Deprecated. The filepath to the temporary file
protected  int fileSize
          Deprecated. The size in bytes of the file
 
Constructor Summary
DiskFile(java.lang.String filePath)
          Deprecated.  
 
Method Summary
 void destroy()
          Deprecated. Delete the temporary file.
 java.lang.String getContentType()
          Deprecated. Get the content type
 byte[] getFileData()
          Deprecated. Attempt to read the temporary file and get it's data in byte array form.
 byte[] getFileData(int bufferSize)
          Deprecated. Attempts to read a file n bytes at a time, n being equal to "bufferSize".
 java.lang.String getFileName()
          Deprecated. Get the file name
 java.lang.String getFilePath()
          Deprecated. Get the temporary file path for this form file
 int getFileSize()
          Deprecated. Get the file size
 java.io.InputStream getInputStream()
          Deprecated. Returns a FileInputStream to the file
 void setContentType(java.lang.String contentType)
          Deprecated. Set the content type
 void setFileName(java.lang.String filename)
          Deprecated. Set the file name
 void setFileSize(int fileSize)
          Deprecated. Set the file size
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

filePath

protected java.lang.String filePath
Deprecated. 
The filepath to the temporary file

contentType

protected java.lang.String contentType
Deprecated. 
The content type of the file

fileSize

protected int fileSize
Deprecated. 
The size in bytes of the file

fileName

protected java.lang.String fileName
Deprecated. 
The name of the file
Constructor Detail

DiskFile

public DiskFile(java.lang.String filePath)
Deprecated. 
Method Detail

getFileData

public byte[] getFileData()
                   throws java.io.FileNotFoundException,
                          java.io.IOException
Deprecated. 
Attempt to read the temporary file and get it's data in byte array form. Tries to read the entire file (using a byte array the size of getFileSize()) at once, in one call to FileInputStream.read(byte[]). For buffered reading, see getFileData(int). Note that this method can be dangerous, and that the size of a file can cause an OutOfMemoryError quite easily. You should use getInputStream and do your own thing.
Specified by:
getFileData in interface FormFile
Throws:
java.io.FileNotFoundException - If the temp file no longer exists
java.io.IOException - if there is some sort of IO problem.
See Also:
getFileData(int)

getFileData

public byte[] getFileData(int bufferSize)
                   throws java.io.FileNotFoundException,
                          java.io.IOException
Deprecated. 
Attempts to read a file n bytes at a time, n being equal to "bufferSize". Note that this method can be dangerous, and that the size of a file can cause an OutOfMemoryError quite easily. You should use getInputStream and do your own thing.
Parameters:
bufferSize - The size in bytes that are read from the file at a time
Throws:
java.io.FileNotFoundException - If the temp file no longer exists

destroy

public void destroy()
Deprecated. 
Delete the temporary file.
Specified by:
destroy in interface FormFile

getFilePath

public java.lang.String getFilePath()
Deprecated. 
Get the temporary file path for this form file
Returns:
A filepath to the temporary file

setFileName

public void setFileName(java.lang.String filename)
Deprecated. 
Set the file name
Specified by:
setFileName in interface FormFile
Following copied from interface: org.apache.struts.upload.FormFile
Parameters:
fileName - The base file name.

setContentType

public void setContentType(java.lang.String contentType)
Deprecated. 
Set the content type
Specified by:
setContentType in interface FormFile
Following copied from interface: org.apache.struts.upload.FormFile
Parameters:
contentType - The content type for the file.

setFileSize

public void setFileSize(int fileSize)
Deprecated. 
Set the file size
Specified by:
setFileSize in interface FormFile
Parameters:
fileSize - The size of the file in bytes

getFileName

public java.lang.String getFileName()
Deprecated. 
Get the file name
Specified by:
getFileName in interface FormFile
Following copied from interface: org.apache.struts.upload.FormFile
Returns:
The base file name.

getContentType

public java.lang.String getContentType()
Deprecated. 
Get the content type
Specified by:
getContentType in interface FormFile
Following copied from interface: org.apache.struts.upload.FormFile
Returns:
A String representing content type.

getFileSize

public int getFileSize()
Deprecated. 
Get the file size
Specified by:
getFileSize in interface FormFile
Returns:
The size of this file in bytes

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.FileNotFoundException,
                                          java.io.IOException
Deprecated. 
Returns a FileInputStream to the file
Specified by:
getInputStream in interface FormFile
Following copied from interface: org.apache.struts.upload.FormFile
Throws:
java.io.FileNotFoundException - if the uploaded file is not found.
java.io.IOException - if an error occurred while reading the file.


Copyright © 2000-2005 - The Apache Software Foundation