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 SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceAn interface for classes that want to post modifications to files.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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.RMObjectaddPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChangeMethods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, 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- 
WebFilepublic WebFile()
 
- 
- 
Method Details- 
getSiteReturns the WebSite.
- 
setSiteSets the WebSite.
- 
getURLReturns the URL for this file.
- 
createURLCreates a URL for this file.
- 
getPathReturns the file path.
- 
setPathSets the file path.
- 
getNameReturns the resource name.
- 
getSimpleNameReturns the file simple name.
- 
getPresentableNameReturns the Filename without extension, and with underscores replaced with spaces
- 
getTypeReturns the file type (extension without the '.').
- 
getDirPathReturns the path as a directory (with trailing separator).
- 
getExistspublic boolean getExists()Returns whether file exists in data source (has been saved and, if so, not deleted).
- 
getExistspublic boolean getExists(boolean doConfirm) Returns whether file exists in data source (with option to confirm if file was created instead of fetched).
- 
setExistsprotected void setExists(boolean aFlag) Sets whether file exists in data source (has been saved and, if so, not deleted).
- 
getParentReturns the file parent directory.
- 
setParentSets the file parent.
- 
getModifiedTimepublic long getModifiedTime()Returns the file modification time.
- 
setModifiedTimepublic void setModifiedTime(long aTime) Sets the file modification time.
- 
getModifiedDateReturns the modified date.
- 
isFilepublic boolean isFile()Returns whether resource is a directory.
- 
isDirectorypublic boolean isDirectory()Returns whether resource is a directory.
- 
setDirectorypublic void setDirectory(boolean aValue) Sets whether resource is a directory.
- 
getSizepublic long getSize()Returns the file size.
- 
setSizepublic void setSize(long aSize) Sets the file size.
- 
getContentResponseReturns files for path.
- 
isBytesSetpublic boolean isBytesSet()Returns whether bytes have been set/loaded for file.
- 
getBytespublic byte[] getBytes()Returns the file bytes.
- 
setBytespublic void setBytes(@Nullable byte[] theBytes) Sets the file bytes.
- 
getFileCountpublic int getFileCount()Returns the number of files in this directory.
- 
getFileReturns the individual file at given index.
- 
getFilesReturns the directory files list.
- 
setFilesSets the directory files list.
- 
initFilesprotected void initFiles()Initialize files.
- 
initFilesInitialize files.
- 
addFileAdds a file.
- 
addFileAdds a file at given index.
- 
removeFileRemoves a file at given index.
- 
removeFileRemoves given file.
- 
createFileReturns the file with the given name.
- 
getFileReturns the file with the given name.
- 
getFilesReturns the list of files that match given regex.
- 
getFileIndexReturns the index of a file.
- 
getInsertIndexReturns the insert index to insert a file in this directory.
- 
getFileNamesReturns the file keys.
- 
getDataTypeReturns the data type of the file.
- 
setDataTypeSets the data type for the file.
- 
getPropReturns a file property for key.
- 
setPropSets a property for a key.
- 
isUpdateSetpublic boolean isUpdateSet()Returns whether update is set and has update.
- 
getUpdaterReturns the updater.
- 
setUpdaterSets the Updater.
- 
saveSaves the file.- Throws:
- ResponseException
 
- 
deleteDeletes the file.- Throws:
- ResponseException
 
- 
refreshpublic void refresh()Revert the file from saved version.
- 
isRootpublic boolean isRoot()Returns whether this directory is root directory.
- 
getURLStringReturns the URL string for this file.
- 
getTextReturns the file bytes as a string.
- 
setTextSets the file bytes as a string.
- 
getInputStreamReturns an input stream for file.
- 
getStandardFileReturns a standard java.io.File, if available.
- 
getURLReturns a relative URL for the given file path.
- 
createURLCreates a URL for string.
- 
equalsStandard equals implementation.
- 
hashCodepublic int hashCode()Standard hashCode implementation.
- 
compareToStandard compareTo implementation.- Specified by:
- compareToin interface- Comparable<WebFile>
 
- 
cloneStandard clone implementation.- Overrides:
- clonein class- RMListenerList
 
- 
getJSONKeysRMJSONArchiver.GetKeys implementation.- Specified by:
- getJSONKeysin interface- RMJSONArchiver.GetKeys
 
- 
toStringReturns a string representation of file.
 
-