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 interface
An interface for classes that want to post modifications to files. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Adds a file.protected void
Adds a file at given index.clone()
Standard clone implementation.int
Standard compareTo implementation.createFile
(String aName) Returns the file with the given name.protected WebURL
Creates a URL for this file.protected WebURL
Creates a URL for string.void
delete()
Deletes the file.boolean
Standard equals implementation.byte[]
getBytes()
Returns the file bytes.protected Response
Returns files for path.Returns the data type of the file.Returns the path as a directory (with trailing separator).boolean
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).getFile
(int anIndex) Returns the individual file at given index.Returns the file with the given name.int
Returns the number of files in this directory.int
getFileIndex
(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.int
getInsertIndex
(WebFile aFile) Returns the insert index to insert a file in this directory.RMJSONArchiver.GetKeys implementation.Returns the modified date.long
Returns 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.long
getSize()
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.int
hashCode()
Standard hashCode implementation.protected void
Initialize files.protected void
Initialize files.boolean
Returns whether bytes have been set/loaded for file.boolean
Returns whether resource is a directory.boolean
isFile()
Returns whether resource is a directory.boolean
isRoot()
Returns whether this directory is root directory.boolean
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
Sets the directory files list.void
setModifiedTime
(long aTime) Sets the file modification time.protected void
Sets the file parent.void
Sets the file path.void
Sets a property for a key.protected void
Sets the WebSite.void
setSize
(long aSize) Sets the file size.void
Sets the file bytes as a string.void
setUpdater
(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, sendPropertyChange
Methods 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:
compareTo
in interfaceComparable<WebFile>
-
clone
Standard clone implementation.- Overrides:
clone
in classRMListenerList
-
getJSONKeys
RMJSONArchiver.GetKeys implementation.- Specified by:
getJSONKeys
in interfaceRMJSONArchiver.GetKeys
-
toString
Returns a string representation of file.
-