public static class FileSystemBrowser.FileElement extends java.lang.Object implements Element
Constructor and Description |
---|
FileElement(Browser browser,
java.io.File file,
java.io.File root) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
Browser |
getBrowser() |
java.lang.Iterable<Element> |
getChildren()
Returns the ordered list of element's children.
|
java.io.File |
getFile() |
java.lang.String |
getFullName()
Returns the unique full name of the element (relative to the root).
|
java.io.InputStream |
getInputStream()
Returns the input stream of the element content.
|
java.lang.String |
getName()
Returns the element's name.
|
long |
getSize()
Returns the size of the element content.
|
int |
hashCode() |
boolean |
isContentAvailable()
Returns whether the content is available for the element.
|
boolean |
isLeaf()
Returns whether the element is a leaf, i.e.
|
java.lang.String |
toString() |
public FileElement(@NotNull Browser browser, @NotNull java.io.File file, @NotNull java.io.File root)
@NotNull public java.lang.String getName()
Element
@NotNull public java.lang.String getFullName()
Element
getFullName
in interface Element
public boolean isLeaf()
Element
public java.lang.Iterable<Element> getChildren()
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
@NotNull public java.io.File getFile()
public boolean isContentAvailable()
Element
getInputStream()
method will result in exception.isContentAvailable
in interface Element
@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
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.
@NotNull public Browser getBrowser()
getBrowser
in interface Element
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object