public class WebFile extends RMObject implements java.lang.Comparable<WebFile>, RMJSONArchiver.GetKeys
Modifier and Type | Class and Description |
---|---|
static interface |
WebFile.Updater
An interface for classes that want to post modifications to files.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
Bytes_Prop |
static java.lang.String |
Exists_Prop |
static java.lang.String |
File_Prop |
static java.lang.String |
Files_Prop |
static java.lang.String |
ModifiedTime_Prop |
static java.lang.String |
Path_Prop |
static java.lang.String |
Size_Prop |
static java.lang.String |
Updater_Prop |
Constructor and Description |
---|
WebFile() |
Modifier and Type | Method and Description |
---|---|
protected void |
addFile(WebFile aFile)
Adds a file.
|
protected void |
addFile(WebFile aFile,
int anIndex)
Adds a file at given index.
|
WebFile |
clone()
Standard clone implementation.
|
int |
compareTo(WebFile aFile)
Standard compareTo implementation.
|
WebFile |
createFile(java.lang.String aName)
Returns the file with the given name.
|
protected WebURL |
createURL()
Creates a URL for this file.
|
protected WebURL |
createURL(java.lang.String aURL)
Creates a URL for string.
|
void |
delete()
Deletes the file.
|
boolean |
equals(java.lang.Object anObj)
Standard equals implementation.
|
byte[] |
getBytes()
Returns the file bytes.
|
protected Response |
getContentResponse()
Returns files for path.
|
DataType |
getDataType()
Returns the data type of the file.
|
java.lang.String |
getDirPath()
Returns the path as a directory (with trailing separator).
|
boolean |
getExists()
Returns whether file exists in data source (has been saved and, if so, not deleted).
|
boolean |
getExists(boolean doConfirm)
Returns whether file exists in data source (with option to confirm if file was created instead of fetched).
|
WebFile |
getFile(int anIndex)
Returns the individual file at given index.
|
WebFile |
getFile(java.lang.String aName)
Returns the file with the given name.
|
int |
getFileCount()
Returns the number of files in this directory.
|
int |
getFileIndex(WebFile aFile)
Returns the index of a file.
|
java.util.List<java.lang.String> |
getFileNames()
Returns the file keys.
|
<T extends WebFile> |
getFiles()
Returns the directory files list.
|
java.util.List<WebFile> |
getFiles(java.lang.String aRegex)
Returns the list of files that match given regex.
|
java.io.InputStream |
getInputStream()
Returns an input stream for file.
|
int |
getInsertIndex(WebFile aFile)
Returns the insert index to insert a file in this directory.
|
java.util.List<java.lang.String> |
getJSONKeys()
RMJSONArchiver.GetKeys implementation.
|
java.util.Date |
getModifiedDate()
Returns the modified date.
|
long |
getModifiedTime()
Returns the file modification time.
|
java.lang.String |
getName()
Returns the resource name.
|
WebFile |
getParent()
Returns the file parent directory.
|
java.lang.String |
getPath()
Returns the file path.
|
java.lang.String |
getPresentableName()
Returns the Filename without extension, and with underscores replaced with spaces
|
java.lang.Object |
getProp(java.lang.String aKey)
Returns a file property for key.
|
java.lang.String |
getSimpleName()
Returns the file simple name.
|
WebSite |
getSite()
Returns the WebSite.
|
long |
getSize()
Returns the file size.
|
java.io.File |
getStandardFile()
Returns a standard java.io.File, if available.
|
java.lang.String |
getText()
Returns the file bytes as a string.
|
java.lang.String |
getType()
Returns the file type (extension without the '.').
|
WebFile.Updater |
getUpdater()
Returns the updater.
|
WebURL |
getURL()
Returns the URL for this file.
|
WebURL |
getURL(java.lang.String aPath)
Returns a relative URL for the given file path.
|
java.lang.String |
getURLString()
Returns the URL string for this file.
|
int |
hashCode()
Standard hashCode implementation.
|
protected void |
initFiles()
Initialize files.
|
protected void |
initFiles(java.util.List<? extends WebFile> theFiles)
Initialize files.
|
boolean |
isBytesSet()
Returns whether bytes have been set/loaded for file.
|
boolean |
isDirectory()
Returns whether resource is a directory.
|
boolean |
isFile()
Returns whether resource is a directory.
|
boolean |
isRoot()
Returns whether this directory is root directory.
|
boolean |
isUpdateSet()
Returns whether update is set and has update.
|
void |
refresh()
Revert the file from saved version.
|
protected WebFile |
removeFile(int anIndex)
Removes a file at given index.
|
protected int |
removeFile(WebFile aFile)
Removes given file.
|
void |
save()
Saves the file.
|
void |
setBytes(byte[] theBytes)
Sets the file bytes.
|
protected void |
setDataType(DataType aDataType)
Sets the data type for the file.
|
void |
setDirectory(boolean aValue)
Sets whether resource is a directory.
|
protected void |
setExists(boolean aFlag)
Sets whether file exists in data source (has been saved and, if so, not deleted).
|
protected void |
setFiles(java.util.List theFiles)
Sets the directory files list.
|
void |
setModifiedTime(long aTime)
Sets the file modification time.
|
protected void |
setParent(WebFile aFile)
Sets the file parent.
|
void |
setPath(java.lang.String aPath)
Sets the file path.
|
void |
setProp(java.lang.String aKey,
java.lang.Object aValue)
Sets a property for a key.
|
protected void |
setSite(WebSite aSite)
Sets the WebSite.
|
void |
setSize(long aSize)
Sets the file size.
|
void |
setText(java.lang.String aString)
Sets the file bytes as a string.
|
void |
setUpdater(WebFile.Updater anUpdater)
Sets the Updater.
|
java.lang.String |
toString()
Returns a string representation of file.
|
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange
addListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
public static final java.lang.String Path_Prop
public static final java.lang.String ModifiedTime_Prop
public static final java.lang.String Bytes_Prop
public static final java.lang.String Size_Prop
public static final java.lang.String File_Prop
public static final java.lang.String Files_Prop
public static final java.lang.String Exists_Prop
public static final java.lang.String Updater_Prop
public WebSite getSite()
protected void setSite(WebSite aSite)
public WebURL getURL()
protected WebURL createURL()
public java.lang.String getPath()
public void setPath(java.lang.String aPath)
public java.lang.String getName()
public java.lang.String getSimpleName()
public java.lang.String getPresentableName()
public java.lang.String getType()
public java.lang.String getDirPath()
public boolean getExists()
public boolean getExists(boolean doConfirm)
protected void setExists(boolean aFlag)
public WebFile getParent()
protected void setParent(WebFile aFile)
public long getModifiedTime()
public void setModifiedTime(long aTime)
public java.util.Date getModifiedDate()
public boolean isFile()
public boolean isDirectory()
public void setDirectory(boolean aValue)
public long getSize()
public void setSize(long aSize)
protected Response getContentResponse()
public boolean isBytesSet()
public byte[] getBytes()
public void setBytes(byte[] theBytes)
public int getFileCount()
public WebFile getFile(int anIndex)
public <T extends WebFile> java.util.List<T> getFiles()
protected void setFiles(java.util.List theFiles)
protected void initFiles()
protected void initFiles(java.util.List<? extends WebFile> theFiles)
protected void addFile(WebFile aFile)
protected void addFile(WebFile aFile, int anIndex)
protected WebFile removeFile(int anIndex)
protected int removeFile(WebFile aFile)
public WebFile createFile(java.lang.String aName)
public WebFile getFile(java.lang.String aName)
public java.util.List<WebFile> getFiles(java.lang.String aRegex)
public int getFileIndex(WebFile aFile)
public int getInsertIndex(WebFile aFile)
public java.util.List<java.lang.String> getFileNames()
public DataType getDataType()
protected void setDataType(DataType aDataType)
public java.lang.Object getProp(java.lang.String aKey)
public void setProp(java.lang.String aKey, java.lang.Object aValue)
public boolean isUpdateSet()
public WebFile.Updater getUpdater()
public void setUpdater(WebFile.Updater anUpdater)
public void save() throws ResponseException
ResponseException
public void delete() throws ResponseException
ResponseException
public void refresh()
public boolean isRoot()
public java.lang.String getURLString()
public java.lang.String getText()
public void setText(java.lang.String aString)
public java.io.InputStream getInputStream()
public java.io.File getStandardFile()
public WebURL getURL(java.lang.String aPath)
protected WebURL createURL(java.lang.String aURL)
public boolean equals(java.lang.Object anObj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(WebFile aFile)
compareTo
in interface java.lang.Comparable<WebFile>
public WebFile clone()
clone
in class RMListenerList
public java.util.List<java.lang.String> getJSONKeys()
getJSONKeys
in interface RMJSONArchiver.GetKeys