Package com.norconex.importer.handler
Class DocHandlerContext
java.lang.Object
com.norconex.importer.handler.DocHandlerContext
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()protected booleancharset()Closest wrappingCondition, if applicable.Closest wrappingCondition, if applicable.boolean@NonNull EventManagerbooleanexecuteDocHandler(DocHandler docHandler) Executes a document handler taking care of firing proper events and passing it this context as well as assigning the handler to "rejectedBy" in case of rejection.voidflush()Flush and dispose any output that has been written to withoutput()and apply it as the input source of the underlying document.inthashCode()input()Flushes any output and returns an adapter for the document input..booleanmetadata()output()Make sure to close the stream when done or explictly flush the stream.@NonNull ParseStateparseState(@NonNull ParseState parseState) rejectedBy(Object rejectedBy) resolveCharset(Charset charset) Return the most appropriate charset for the current context.toString()
-
Method Details
-
metadata
-
reference
-
contentType
-
parentReferences
-
charset
-
streamFactory
-
isRejected
public boolean isRejected() -
resolveCharset
Return the most appropriate charset for the current context. Logic (in order):- If the document has been parsed already, return UTF-8.
- If the provided Charset if not
null, return it. - If the document has a Charset on it, return it.
- Fallback to UTF-8.
- Parameters:
charset- the charset to use if non-null and the document has not been parsed yet.- Returns:
- a character set (never
null)
-
flush
Flush and dispose any output that has been written to withoutput()and apply it as the input source of the underlying document.- Throws:
IOException
-
input
Flushes any output and returns an adapter for the document input..- Returns:
- document input adapter
- Throws:
IOException
-
output
Make sure to close the stream when done or explictly flush the stream.- Returns:
- output adapter
-
executeDocHandler
Executes a document handler taking care of firing proper events and passing it this context as well as assigning the handler to "rejectedBy" in case of rejection.- Parameters:
docHandler- document handler to invoke- Returns:
trueto move to the next handler- Throws:
IOException
-
builder
-
parseState
- Returns:
this.
-
condition
Closest wrappingCondition, if applicable.- Parameters:
condition- a condition- Returns:
this.
-
rejectedBy
- Returns:
this.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-
childDocs
-
parseState
-
condition
Closest wrappingCondition, if applicable.- Returns:
- condition
-
eventManager
-
rejectedBy
-