|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.File
org.silverpeas.file.SilverpeasFile
public class SilverpeasFile
A representation of a File in Silverpeas. This class abstracts the way the files are managed in Silverpeas by extending the original JDK file with additional features. A file in Silverpeas belongs always to a component instance and is qualified by its MIME type.
Such file can be either a document referred by a publication's attachment or an image from a form.
Field Summary | |
---|---|
static SilverpeasFile |
NO_FILE
A SilverpeasFile representing a non existent file. |
Fields inherited from class java.io.File |
---|
pathSeparator, pathSeparatorChar, separator, separatorChar |
Constructor Summary | |
---|---|
protected |
SilverpeasFile(String componentId,
String path)
Creates a new Silverpeas file beloging to the specified component instance and located at the specified path in the Silverpeas filesystem. |
protected |
SilverpeasFile(String componentId,
String path,
String mimeType)
Creates a new Silverpeas file beloging to the specified component instance and located at the specified path in the Silverpeas filesystem. |
Method Summary | |
---|---|
SilverpeasFile |
copyInto(String directoryPath)
Copies this file into the specified directory. |
boolean |
delete()
|
boolean |
exists()
|
String |
getComponentInstanceId()
|
String |
getMimeType()
|
InputStream |
inputStream()
Opens and returns an input stream to this file. |
boolean |
isArchive()
Indicates if the current silverpeas file is of type archive. |
boolean |
isFileSecure()
|
boolean |
isImage()
Indicates if the current file is of type image. |
boolean |
isMail()
Indicates if the current file is of type mail. |
boolean |
isOpenOfficeCompatible()
Indicates if the current file is of type OpenOffice compatible. |
boolean |
isPdf()
Indicates if the current file is of type PDF. |
SilverpeasFile |
moveInto(String directoryPath)
Moves this file into the specified directory. |
void |
writeFrom(InputStream stream)
Writes the content of the specified input stream into this file. |
Methods inherited from class java.io.File |
---|
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, deleteOnExit, equals, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final SilverpeasFile NO_FILE
Constructor Detail |
---|
protected SilverpeasFile(String componentId, String path)
componentId
- the unique identifier of the component instance.path
- the absolute path of the file.protected SilverpeasFile(String componentId, String path, String mimeType)
componentId
- the unique identifier of the component instance.path
- the absolute path of the file.mimeType
- the MIME type of the file.Method Detail |
---|
public String getMimeType()
public String getComponentInstanceId()
public boolean exists()
exists
in class File
public boolean delete()
delete
in class File
A chain of post-processors will be ran once this file deleted to perform possible additional
treatments.
public InputStream inputStream() throws IOException
IOException
- if an error occurs while opening the input stream.public void writeFrom(InputStream stream) throws IOException
stream
- the input stream from which the content to write is fetched.
IOException
- if an error occurs while writing the content from the specified
input stream into this file.public SilverpeasFile moveInto(String directoryPath) throws IOException
NO_FILE
is returned.
A chain of post-processors will be ran once this file is moved to the directory to perform
possible additional treatments on the the moved file.
The moving operation will create a new file in the specified directory with the content of this
file and then delete this file. Consequently, a chain of post-processors will be ran against
the deleted file to perform additional treatments at file deletion.
directoryPath
- the absolute path of the directory into which this file has to be moved.
IOException
- if an error occurs while moving this file into the specified
directorypublic SilverpeasFile copyInto(String directoryPath) throws IOException
directoryPath
- the absolute path of the directory into which this file has to be moved.
IOException
- if an error occurs while copying this file into the specified
directorypublic boolean isArchive()
public boolean isImage()
public boolean isMail()
public boolean isPdf()
public boolean isOpenOfficeCompatible()
public boolean isFileSecure()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |