Package com.inductiveautomation.snap.web
Class WebFile
java.lang.Object
com.inductiveautomation.rm.base.RMListenerList
com.inductiveautomation.rm.base.RMObject
com.inductiveautomation.snap.web.WebFile
- All Implemented Interfaces:
RMJSONArchiver.GetKeys,RMPropertyChanger,Cloneable,Comparable<WebFile>
- Direct Known Subclasses:
ZipFileSite.ZipDataFile
Represents a file from a WebSite.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn interface for classes that want to post modifications to files. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds a file.protected voidAdds a file at given index.clone()Standard clone implementation.intStandard compareTo implementation.createFile(String aName) Returns the file with the given name.protected WebURLCreates a URL for this file.protected WebURLCreates a URL for string.voiddelete()Deletes the file.booleanStandard equals implementation.byte[]getBytes()Returns the file bytes.protected ResponseReturns files for path.Returns the data type of the file.Returns the path as a directory (with trailing separator).booleanReturns whether file exists in data source (has been saved and, if so, not deleted).booleangetExists(boolean doConfirm) Returns whether file exists in data source (with option to confirm if file was created instead of fetched).getFile(int anIndex) Returns the individual file at given index.Returns the file with the given name.intReturns the number of files in this directory.intgetFileIndex(WebFile aFile) Returns the index of a file.Returns the file keys.getFiles()Returns the directory files list.Returns the list of files that match given regex.Returns an input stream for file.intgetInsertIndex(WebFile aFile) Returns the insert index to insert a file in this directory.RMJSONArchiver.GetKeys implementation.Returns the modified date.longReturns the file modification time.getName()Returns the resource name.Returns the file parent directory.getPath()Returns the file path.Returns the Filename without extension, and with underscores replaced with spacesReturns a file property for key.Returns the file simple name.getSite()Returns the WebSite.longgetSize()Returns the file size.Returns a standard java.io.File, if available.getText()Returns the file bytes as a string.getType()Returns the file type (extension without the '.').Returns the updater.getURL()Returns the URL for this file.Returns a relative URL for the given file path.Returns the URL string for this file.inthashCode()Standard hashCode implementation.protected voidInitialize files.protected voidInitialize files.booleanReturns whether bytes have been set/loaded for file.booleanReturns whether resource is a directory.booleanisFile()Returns whether resource is a directory.booleanisRoot()Returns whether this directory is root directory.booleanReturns whether update is set and has update.voidrefresh()Revert the file from saved version.protected WebFileremoveFile(int anIndex) Removes a file at given index.protected intremoveFile(WebFile aFile) Removes given file.voidsave()Saves the file.voidsetBytes(byte[] theBytes) Sets the file bytes.protected voidsetDataType(DataType aDataType) Sets the data type for the file.voidsetDirectory(boolean aValue) Sets whether resource is a directory.protected voidsetExists(boolean aFlag) Sets whether file exists in data source (has been saved and, if so, not deleted).protected voidSets the directory files list.voidsetModifiedTime(long aTime) Sets the file modification time.protected voidSets the file parent.voidSets the file path.voidSets a property for a key.protected voidSets the WebSite.voidsetSize(long aSize) Sets the file size.voidSets the file bytes as a string.voidsetUpdater(WebFile.Updater anUpdater) Sets the Updater.toString()Returns a string representation of file.Methods inherited from class com.inductiveautomation.rm.base.RMObject
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChangeMethods inherited from class com.inductiveautomation.rm.base.RMListenerList
addListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
-
Field Details
-
Path_Prop
- See Also:
-
ModifiedTime_Prop
- See Also:
-
Bytes_Prop
- See Also:
-
Size_Prop
- See Also:
-
File_Prop
- See Also:
-
Files_Prop
- See Also:
-
Exists_Prop
- See Also:
-
Updater_Prop
- See Also:
-
-
Constructor Details
-
WebFile
public WebFile()
-
-
Method Details
-
getSite
Returns the WebSite. -
setSite
Sets the WebSite. -
getURL
Returns the URL for this file. -
createURL
Creates a URL for this file. -
getPath
Returns the file path. -
setPath
Sets the file path. -
getName
Returns the resource name. -
getSimpleName
Returns the file simple name. -
getPresentableName
Returns the Filename without extension, and with underscores replaced with spaces -
getType
Returns the file type (extension without the '.'). -
getDirPath
Returns the path as a directory (with trailing separator). -
getExists
public boolean getExists()Returns whether file exists in data source (has been saved and, if so, not deleted). -
getExists
public boolean getExists(boolean doConfirm) Returns whether file exists in data source (with option to confirm if file was created instead of fetched). -
setExists
protected void setExists(boolean aFlag) Sets whether file exists in data source (has been saved and, if so, not deleted). -
getParent
Returns the file parent directory. -
setParent
Sets the file parent. -
getModifiedTime
public long getModifiedTime()Returns the file modification time. -
setModifiedTime
public void setModifiedTime(long aTime) Sets the file modification time. -
getModifiedDate
Returns the modified date. -
isFile
public boolean isFile()Returns whether resource is a directory. -
isDirectory
public boolean isDirectory()Returns whether resource is a directory. -
setDirectory
public void setDirectory(boolean aValue) Sets whether resource is a directory. -
getSize
public long getSize()Returns the file size. -
setSize
public void setSize(long aSize) Sets the file size. -
getContentResponse
Returns files for path. -
isBytesSet
public boolean isBytesSet()Returns whether bytes have been set/loaded for file. -
getBytes
public byte[] getBytes()Returns the file bytes. -
setBytes
public void setBytes(@Nullable byte[] theBytes) Sets the file bytes. -
getFileCount
public int getFileCount()Returns the number of files in this directory. -
getFile
Returns the individual file at given index. -
getFiles
Returns the directory files list. -
setFiles
Sets the directory files list. -
initFiles
protected void initFiles()Initialize files. -
initFiles
Initialize files. -
addFile
Adds a file. -
addFile
Adds a file at given index. -
removeFile
Removes a file at given index. -
removeFile
Removes given file. -
createFile
Returns the file with the given name. -
getFile
Returns the file with the given name. -
getFiles
Returns the list of files that match given regex. -
getFileIndex
Returns the index of a file. -
getInsertIndex
Returns the insert index to insert a file in this directory. -
getFileNames
Returns the file keys. -
getDataType
Returns the data type of the file. -
setDataType
Sets the data type for the file. -
getProp
Returns a file property for key. -
setProp
Sets a property for a key. -
isUpdateSet
public boolean isUpdateSet()Returns whether update is set and has update. -
getUpdater
Returns the updater. -
setUpdater
Sets the Updater. -
save
Saves the file.- Throws:
ResponseException
-
delete
Deletes the file.- Throws:
ResponseException
-
refresh
public void refresh()Revert the file from saved version. -
isRoot
public boolean isRoot()Returns whether this directory is root directory. -
getURLString
Returns the URL string for this file. -
getText
Returns the file bytes as a string. -
setText
Sets the file bytes as a string. -
getInputStream
Returns an input stream for file. -
getStandardFile
Returns a standard java.io.File, if available. -
getURL
Returns a relative URL for the given file path. -
createURL
Creates a URL for string. -
equals
Standard equals implementation. -
hashCode
public int hashCode()Standard hashCode implementation. -
compareTo
Standard compareTo implementation.- Specified by:
compareToin interfaceComparable<WebFile>
-
clone
Standard clone implementation.- Overrides:
clonein classRMListenerList
-
getJSONKeys
RMJSONArchiver.GetKeys implementation.- Specified by:
getJSONKeysin interfaceRMJSONArchiver.GetKeys
-
toString
Returns a string representation of file.
-