public interface Element
It is strongly recommended to implement equals()
and hashCode()
methods, since Element
s are actively used in hash containers.
Modifier and Type | Method and Description |
---|---|
Browser |
getBrowser() |
java.lang.Iterable<Element> |
getChildren()
Returns the ordered list of element's children.
|
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.
|
boolean |
isContentAvailable()
Returns whether the content is available for the element.
|
boolean |
isLeaf()
Returns whether the element is a leaf, i.e.
|
@NotNull java.lang.String getName()
@NotNull java.lang.String getFullName()
boolean isLeaf()
@Nullable java.lang.Iterable<Element> getChildren() throws BrowserException
null
for a leaf element, and a
not null
instance for other elements.
List can be empty. All children's names are different.BrowserException
- in case of an errorboolean isContentAvailable()
getInputStream()
method will result in exception.@NotNull java.io.InputStream getInputStream() throws java.lang.IllegalStateException, java.io.IOException, BrowserException
If the content is not available for the element (see isContentAvailable()
), an exception is thrown.
java.lang.IllegalStateException
- if the content is not availablejava.io.IOException
- if the input cannot be provided due to I/O errorBrowserException
- indicates a general error occurred during input stream openinglong getSize()
If the content is not available for the element (see 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 Browser getBrowser()