Interface IHierarchicalContentNode
-
public interface IHierarchicalContentNode
Read only abstraction over a node inIHierarchicalContent
that provides access to a file and its content.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
exists()
Returnstrue
if the content node exists.java.lang.String
getChecksum()
Returns the checksum of a file abstracted by this node.int
getChecksumCRC32()
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.File
getFile()
Returns a file abstracted by this node.ch.systemsx.cisd.base.io.IRandomAccessFile
getFileContent()
Returns a read onlyIRandomAccessFile
with file content of the node.long
getFileLength()
Returns the length (in bytes) of a file abstracted by this node.java.io.InputStream
getInputStream()
Returns anInputStream
with content of the node.long
getLastModified()
Returns the time this node or the persistent object containing this node has been modified.java.lang.String
getName()
Returns name of this node/file.java.lang.String
getParentRelativePath()
Returns relative path of this node's parent ornull
for root node.java.lang.String
getRelativePath()
Returns relative path of this node or empty string for root node.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.boolean
isDirectory()
Returnstrue
if this node is an abstraction of a directory,false
otherwise.java.io.File
tryGetFile()
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 ornull
for root node.
-
exists
boolean exists()
Returnstrue
if the content node exists.
-
isDirectory
boolean isDirectory()
Returnstrue
if this node is an abstraction of a directory,false
otherwise.
-
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.UnsupportedOperationException
Returns 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.UnsupportedOperationException
Returns 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.UnsupportedOperationException
Returns 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.UnsupportedOperationException
Returns the checksum of a file abstracted by this node. The returned value is of the form<checksum type>:<checksum>
. If it isn't defined anull
is 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.IOExceptionUnchecked
Returns a read onlyIRandomAccessFile
with 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.IOExceptionUnchecked
Returns anInputStream
with 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.
-
-