public static class FileSystemBrowser.DirectoryElement extends FileSystemBrowser.FileElement
Constructor and Description |
---|
DirectoryElement(Browser browser,
java.io.File file,
java.io.File root) |
Modifier and Type | Method and Description |
---|---|
java.lang.Iterable<Element> |
getChildren()
Returns the ordered list of element's children.
|
java.io.InputStream |
getInputStream()
Returns the input stream of the element content.
|
long |
getSize()
Returns the size of the element content.
|
boolean |
isContentAvailable()
Returns whether the content is available for the element.
|
boolean |
isLeaf()
Returns whether the element is a leaf, i.e.
|
equals, getBrowser, getFile, getFullName, getName, hashCode, toString
public DirectoryElement(@NotNull Browser browser, @NotNull java.io.File file, @NotNull java.io.File root)
public boolean isLeaf()
Element
isLeaf
in interface Element
isLeaf
in class FileSystemBrowser.FileElement
public java.lang.Iterable<Element> getChildren() throws BrowserException
Element
null
for a leaf element, and a
not null
instance for other elements.
List can be empty. All children's names are different.getChildren
in interface Element
getChildren
in class FileSystemBrowser.FileElement
BrowserException
- in case of an errorpublic boolean isContentAvailable()
Element
getInputStream()
method will result in exception.isContentAvailable
in interface Element
isContentAvailable
in class FileSystemBrowser.FileElement
@NotNull public java.io.InputStream getInputStream() throws java.lang.IllegalStateException, java.io.IOException
Element
If the content is not available for the element (see Element.isContentAvailable()
), an exception is thrown.
getInputStream
in interface Element
getInputStream
in class FileSystemBrowser.FileElement
java.lang.IllegalStateException
- if the content is not availablejava.io.IOException
- if the input cannot be provided due to I/O errorpublic long getSize() throws java.lang.IllegalStateException
Element
If the content is not available for the element (see Element.isContentAvailable()
) or due to performance reasons a negative value may be returned.
Though some implementations can provide the content size, while the content is not available.
getSize
in interface Element
getSize
in class FileSystemBrowser.FileElement
java.lang.IllegalStateException