info.magnolia.cms.beans.runtime
Class Document

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

public class Document
extends Object
implements 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(File file, 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.
 String getAtomName()
          Returns the parameter name.
 String getExtension()
          Returns the file extension.
 File getFile()
          Returns the uploaded file.
 String getFileName()
          Returns the file name without extension.
 String getFileNameWithExtension()
          Returns the full file name with extension (if existing).
 long getLength()
          Returns the file length in bytes.
 InputStream getStream()
          Returns a stream from the uploaded file.
 String getType()
          Returns the mime type for this file.
 void setAtomName(String name)
          Sets the parameter name.
 void setExtension(String ext)
           
 void setExtention(String ext)
          Deprecated. since 4.1.1 typo in method name - use setExtension instead
 void setFile(File in)
          Sets a reference to the uploaded file.
 void setFileName(String name)
          Sets the file name without extension.
 void setType(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(File file,
                String type)
Used to create a document based on a existing file.

Method Detail

setAtomName

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

Parameters:
name - parameter name

getAtomName

public String getAtomName()
Returns the parameter name.

Returns:
parameter name

setFileName

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

Parameters:
name - file name without extension

getFileName

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

Returns:
file name

getFileNameWithExtension

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

Returns:
file name with extension

setType

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

Parameters:
type - mime type

getType

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

Returns:
mime type

setFile

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

Parameters:
in - file

setExtention

public void setExtention(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(String ext)

getExtension

public String getExtension()
Returns the file extension.

Returns:
file extension

getLength

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

Returns:
file length

getStream

public 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 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-2013 Magnolia International Ltd.. All Rights Reserved.