com.jalios.jcms
Class ChannelFile
java.lang.Object
java.io.File
com.jalios.jcms.ChannelFile
- All Implemented Interfaces:
- Serializable, Comparable<File>
public class ChannelFile
- extends File
ChannelFile is the class of the files belonging to
a channel upload tree.
- Version:
- $Revision: 24265 $
- Author:
- Cécile Le Pape
- See Also:
- Serialized Form
Methods inherited from class java.io.File |
canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getName, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toString, toURI, toURL |
REVISION
public static final String REVISION
- See Also:
- Constant Field Values
FOLDER
public static final String FOLDER
- See Also:
- Constant Field Values
DEFAULT
public static final String DEFAULT
- See Also:
- Constant Field Values
UNKNOWN_TYPE
public static final String UNKNOWN_TYPE
- See Also:
- Constant Field Values
MIME
public static final String MIME
- See Also:
- Constant Field Values
ICON
public static final String ICON
- See Also:
- Constant Field Values
PROP
public static final String PROP
- See Also:
- Constant Field Values
BYTE_EXT
public static final String BYTE_EXT
- See Also:
- Constant Field Values
channel
protected Channel channel
ChannelFile
public ChannelFile(String pathname)
ChannelFile
public ChannelFile(String pathname,
String filename)
ChannelFile
public ChannelFile(File parent,
String filename)
getLengthToString
public String getLengthToString()
getIconPath
public String getIconPath()
- Returns:
- the file icon path relative to the channel
path and based on its extension; a default icon path otherwise.
getExt
public String getExt()
- Returns:
- the file extension if there is one; an empty
string otherwise.
isImage
public boolean isImage()
- Returns:
true
if the file is an image, based on its
MIME type; false
otherwise.
getType
public String getType()
- Returns:
- the MIME type of the file;
ChannelFile.FOLDER
if directory;
ChannelFile.UNKNOWN_TYPE
if the MIME type is unknown.
getLastModified
public Date getLastModified()
- Returns:
- the date of the file last modification.
getChannelRelativePath
public String getChannelRelativePath()
- Returns:
- the file path relative to the channel work directory;
null
if the channel work directory is invalid.
getChannel
public Channel getChannel()
getNameComparator
public static Comparator getNameComparator()
- Returns:
- a name comparator based on the
String.compareTo(String)
method.
Use only with ChannelFile
objects.
getSizeComparator
public static Comparator getSizeComparator()
- Returns:
- a size comparator.
Use only with ChannelFile
objects.
getModifiedComparator
public static Comparator getModifiedComparator()
- Returns:
- a last modified date comparator.
Use only with ChannelFile
objects.
getTypeComparator
public static Comparator getTypeComparator()
- Returns:
- a MIME type comparator.
Use only with ChannelFile
objects. - See Also:
getType()
compactFile
public static String compactFile(int maxlength,
String s)
- Compact a string, replacing extra characters with dots.
- Parameters:
maxlength
- the maximum length of the strings
- the string to compact
- Returns:
- the compacted string
getCopyOfFile
public static File getCopyOfFile(File file,
String copyPrefix)
- copy a
File
, adding a prefix to the new file name;
Prefixes are indexed in case of multiples copies.
- Parameters:
file
- the file to copycopyPrefix
- the new file name prefix; must end with
_
(example: copy_
).
Copyright © 2001-2010 Jalios SA. All Rights Reserved.