info.magnolia.cms.beans.runtime
Class Document

java.lang.Object
  extended by info.magnolia.cms.beans.runtime.Document
All Implemented Interfaces:
java.io.Serializable

public class Document
extends java.lang.Object
implements java.io.Serializable

A wrapper for a temporary uploaded file. User: sameercharles Date: Apr 28, 2003 Time: 11:20:59 AM

Version:
1.1
Author:
Sameer Charles
See Also:
Serialized Form

Constructor Summary
Document(java.io.File file, java.lang.String type)
          Used to create a document based on a existing file.
 
Method Summary
 void delete()
          Delete the file, taking care of closing an open input stream.
 java.lang.String getAtomName()
          Returns the parameter name.
 java.lang.String getExtension()
          Returns the file extension.
 java.io.File getFile()
          Returns the uploaded file.
 java.lang.String getFileName()
          Returns the file name without extension.
 java.lang.String getFileNameWithExtension()
          Returns the full file name with extension (if existing).
 long getLength()
          Returns the file length in bytes.
 java.io.InputStream getStream()
          Returns a stream from the uploaded file.
 java.lang.String getType()
          Returns the mime type for this file.
 void setAtomName(java.lang.String name)
          Sets the parameter name.
 void setExtension(java.lang.String ext)
           
 void setExtention(java.lang.String ext)
          Deprecated. since 4.1.1 typo in method name - use setExtension instead
 void setFile(java.io.File in)
          Sets a reference to the uploaded file.
 void setFileName(java.lang.String name)
          Sets the file name without extension.
 void setType(java.lang.String type)
          Sets the mime type for this file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Document

public Document(java.io.File file,
                java.lang.String type)
Used to create a document based on a existing file.

Method Detail

setAtomName

public void setAtomName(java.lang.String name)
Sets the parameter name.

Parameters:
name - parameter name

getAtomName

public java.lang.String getAtomName()
Returns the parameter name.

Returns:
parameter name

setFileName

public void setFileName(java.lang.String name)
Sets the file name without extension.

Parameters:
name - file name without extension

getFileName

public java.lang.String getFileName()
Returns the file name without extension.

Returns:
file name

getFileNameWithExtension

public java.lang.String getFileNameWithExtension()
Returns the full file name with extension (if existing).

Returns:
file name with extension

setType

public void setType(java.lang.String type)
Sets the mime type for this file.

Parameters:
type - mime type

getType

public java.lang.String getType()
Returns the mime type for this file.

Returns:
mime type

setFile

public void setFile(java.io.File in)
Sets a reference to the uploaded file.

Parameters:
in - file

setExtention

public void setExtention(java.lang.String ext)
Deprecated. since 4.1.1 typo in method name - use setExtension instead

Sets the file extension.

Parameters:
ext - file extension

setExtension

public void setExtension(java.lang.String ext)

getExtension

public java.lang.String getExtension()
Returns the file extension.

Returns:
file extension

getLength

public long getLength()
Returns the file length in bytes.

Returns:
file length

getStream

public java.io.InputStream getStream()
Returns a stream from the uploaded file. Note that subsequent invocation will always return a reference to the same input stream.

Returns:
stream from the uploaded file

getFile

public java.io.File getFile()
Returns the uploaded file. Users should normally use getStream, but getFile() can be used when you need to repeatedly access the file. The obtained file should never be deleted by the caller

Returns:
a reference to the uploaded file.

delete

public void delete()
Delete the file, taking care of closing an open input stream.



Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.