Interface IHierarchicalContentNode
-
public interface IHierarchicalContentNodeRead only abstraction over a node inIHierarchicalContentthat provides access to a file and its content.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanexists()Returnstrueif the content node exists.java.lang.StringgetChecksum()Returns the checksum of a file abstracted by this node.intgetChecksumCRC32()Returns the CRC32 checksum of a file abstracted by this node.java.util.List<IHierarchicalContentNode>getChildNodes()List of child nodes of this node.java.io.FilegetFile()Returns a file abstracted by this node.ch.systemsx.cisd.base.io.IRandomAccessFilegetFileContent()Returns a read onlyIRandomAccessFilewith file content of the node.longgetFileLength()Returns the length (in bytes) of a file abstracted by this node.java.io.InputStreamgetInputStream()Returns anInputStreamwith content of the node.longgetLastModified()Returns the time this node or the persistent object containing this node has been modified.java.lang.StringgetName()Returns name of this node/file.java.lang.StringgetParentRelativePath()Returns relative path of this node's parent ornullfor root node.java.lang.StringgetRelativePath()Returns relative path of this node or empty string for root node.booleanisChecksumCRC32Precalculated()Returnstrue, if the CRC32 checksum is pre-calculated for this node andfalse, if it is calculated on demand when callinggetChecksumCRC32()or if this node does not have a CRC32 checksum (like e.g.booleanisDirectory()Returnstrueif this node is an abstraction of a directory,falseotherwise.java.io.FiletryGetFile()Returns a file abstracted by this node, ornull, if there is no file that represents this node.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns name of this node/file.
-
getRelativePath
java.lang.String getRelativePath()
Returns relative path of this node or empty string for root node.
-
getParentRelativePath
java.lang.String getParentRelativePath()
Returns relative path of this node's parent ornullfor root node.
-
exists
boolean exists()
Returnstrueif the content node exists.
-
isDirectory
boolean isDirectory()
Returnstrueif this node is an abstraction of a directory,falseotherwise.
-
getLastModified
long getLastModified()
Returns the time this node or the persistent object containing this node has been modified.- Returns:
- A long value representing the time of last modification, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
-
getChildNodes
java.util.List<IHierarchicalContentNode> getChildNodes() throws java.lang.UnsupportedOperationException
List of child nodes of this node.NOTE: Call
isDirectory()first to make sure this node is a directory.- Throws:
java.lang.UnsupportedOperationException- if the node is not an abstraction of a directory.
-
getFile
java.io.File getFile() throws java.lang.UnsupportedOperationExceptionReturns a file abstracted by this node.- Throws:
java.lang.UnsupportedOperationException- if the backing store is not a normal file/directory.
-
tryGetFile
java.io.File tryGetFile()
Returns a file abstracted by this node, ornull, if there is no file that represents this node.
-
getFileLength
long getFileLength() throws java.lang.UnsupportedOperationExceptionReturns the length (in bytes) of a file abstracted by this node.NOTE: Call
isDirectory()first to make sure this node is NOT a directory.- Throws:
java.lang.UnsupportedOperationException- if the node is an abstraction of a directory.
-
getChecksumCRC32
int getChecksumCRC32() throws java.lang.UnsupportedOperationExceptionReturns the CRC32 checksum of a file abstracted by this node.NOTE: Call
isDirectory()first to make sure this node is NOT a directory.- Throws:
java.lang.UnsupportedOperationException- if the node is an abstraction of a directory.
-
isChecksumCRC32Precalculated
boolean isChecksumCRC32Precalculated()
Returnstrue, if the CRC32 checksum is pre-calculated for this node andfalse, if it is calculated on demand when callinggetChecksumCRC32()or if this node does not have a CRC32 checksum (like e.g. a directory).
-
getChecksum
java.lang.String getChecksum() throws java.lang.UnsupportedOperationExceptionReturns the checksum of a file abstracted by this node. The returned value is of the form<checksum type>:<checksum>. If it isn't defined anullis returned. It will not be calculated contrary to the behavior ofgetChecksumCRC32().- Throws:
java.lang.UnsupportedOperationException- if the node is an abstraction of a directory.
-
getFileContent
ch.systemsx.cisd.base.io.IRandomAccessFile getFileContent() throws java.lang.UnsupportedOperationException, ch.systemsx.cisd.base.exceptions.IOExceptionUncheckedReturns a read onlyIRandomAccessFilewith file content of the node. *NOTE: Call
isDirectory()first to make sure this node is NOT a directory.- Throws:
java.lang.UnsupportedOperationException- if the node is an abstraction of a directory.ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked- if an I/O error occurs.
-
getInputStream
java.io.InputStream getInputStream() throws java.lang.UnsupportedOperationException, ch.systemsx.cisd.base.exceptions.IOExceptionUncheckedReturns anInputStreamwith content of the node.NOTE: Call
isDirectory()first to make sure this node is NOT a directory.- Throws:
java.lang.UnsupportedOperationException- if the node is an abstraction of a directory.ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked- if an I/O error occurs.
-
-