Package org.apache.rat.api
Class Document
java.lang.Object
org.apache.rat.api.Document
- All Implemented Interfaces:
Comparable<Document>
- Direct Known Subclasses:
ArchiveEntryDocument
,FileDocument
,IgnoredDocument
The representation of a document being scanned.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DocumentName
The fully qualified name of this documentprotected final DocumentNameMatcher
The path matcher used by this document -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Document
(DocumentName name, DocumentNameMatcher nameMatcher) Creates an instance. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
final MetaData
Gets data describing this resource.final DocumentName
getName()
Gets the name of the current document.final DocumentNameMatcher
Gets the file filter this document was created with.int
hashCode()
abstract InputStream
Streams the document's contents.abstract boolean
Determines if this document is a directory type.final boolean
Checks if document is ignored or not.Gets a sorted set of documents that are children of this document.reader()
Reads the contents of this document.toString()
Representations suitable for logging.
-
Field Details
-
nameMatcher
The path matcher used by this document -
name
The fully qualified name of this document
-
-
Constructor Details
-
Document
Creates an instance.- Parameters:
name
- the native NameSet of the resource.nameMatcher
- the document name matcher to filter directories/files.
-
-
Method Details
-
getName
Gets the name of the current document.- Returns:
- the name of the current document.
-
getNameMatcher
Gets the file filter this document was created with.- Returns:
- the file filter this document was created with.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Document>
-
hashCode
public int hashCode() -
equals
-
reader
Reads the contents of this document.- Returns:
Reader
not null- Throws:
IOException
- if this document cannot be read.
-
inputStream
Streams the document's contents.- Returns:
- a non-null input stream of the document.
- Throws:
IOException
- when stream could not be opened.
-
getMetaData
Gets data describing this resource.- Returns:
- a non-null MetaData object.
-
isIgnored
public final boolean isIgnored()Checks if document is ignored or not.- Returns:
true
if the document is of typeIGNORED
.
-
toString
Representations suitable for logging. -
isDirectory
public abstract boolean isDirectory()Determines if this document is a directory type.- Returns:
true
if this is a directory.
-
listChildren
Gets a sorted set of documents that are children of this document.- Returns:
- A sorted set of child Documents. May be empty.
-