Package com.fasterxml.jackson.core.io
Class ContentReference
- java.lang.Object
 - 
- com.fasterxml.jackson.core.io.ContentReference
 
 
- 
- All Implemented Interfaces:
 java.io.Serializable
public class ContentReference extends java.lang.Object implements java.io.SerializableAbstraction that encloses information about content being processed -- input source or output target, streaming or not -- for the purpose of including pertinent information in location (seeJsonLocation) objections, most commonly to be printed out as part ofExceptionmessages.- Since:
 - 2.13
 - See Also:
 - Serialized Form
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_CONTENT_SNIPPETDeprecated.Since 2.16. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringBuilderappendSourceDescription(java.lang.StringBuilder sb)Method for appending a "source description" when content represented by this reference is read.java.lang.StringbuildSourceDescription()Method for constructing a "source description" when content represented by this reference is read.static ContentReferenceconstruct(boolean isContentTextual, java.lang.Object rawContent)Deprecated.Since 2.16.static ContentReferenceconstruct(boolean isContentTextual, java.lang.Object rawContent, int offset, int length)Deprecated.Since 2.16.static ContentReferenceconstruct(boolean isContentTextual, java.lang.Object rawContent, int offset, int length, ErrorReportConfiguration errorReportConfiguration)static ContentReferenceconstruct(boolean isContentTextual, java.lang.Object rawContent, ErrorReportConfiguration errorReportConfiguration)intcontentLength()intcontentOffset()booleanequals(java.lang.Object other)java.lang.ObjectgetRawContent()inthashCode()booleanhasTextualContent()static ContentReferencerawReference(boolean isContentTextual, java.lang.Object rawContent)Factory method for legacy code to use for constructing instances to content about which only minimal amount of information is available.static ContentReferencerawReference(java.lang.Object rawContent)static ContentReferenceredacted()Accessor for getting a placeholder when actual content is not to be exposed: different fromunknown()where content is not available to be referenced.static ContentReferenceunknown()Accessor for getting a placeholder for cases where actual content is not known (or is not something that system wants to expose). 
 - 
 
- 
- 
Field Detail
- 
DEFAULT_MAX_CONTENT_SNIPPET
@Deprecated public static final int DEFAULT_MAX_CONTENT_SNIPPET
Deprecated.Since 2.16.ErrorReportConfiguration.DEFAULT_MAX_RAW_CONTENT_LENGTHwill be used instead.Include at most first 500 characters/bytes from contents; should be enough to give context, but not cause unfortunate side effects in things like logs.- Since:
 - 2.9
 - See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
unknown
public static ContentReference unknown()
Accessor for getting a placeholder for cases where actual content is not known (or is not something that system wants to expose).- Returns:
 - Placeholder "unknown" (or "empty") instance to use instead of
    
nullreference 
 
- 
redacted
public static ContentReference redacted()
Accessor for getting a placeholder when actual content is not to be exposed: different fromunknown()where content is not available to be referenced.- Returns:
 - Placeholder instance to use in cases where reference is explicitly blocked, usually for security reasons.
 - Since:
 - 2.16
 
 
- 
construct
@Deprecated public static ContentReference construct(boolean isContentTextual, java.lang.Object rawContent)
Deprecated.Since 2.16. Useconstruct(boolean, Object, ErrorReportConfiguration)instead. 
- 
construct
@Deprecated public static ContentReference construct(boolean isContentTextual, java.lang.Object rawContent, int offset, int length)
Deprecated.Since 2.16. Useconstruct(boolean, Object, int, int, ErrorReportConfiguration)instead. 
- 
construct
public static ContentReference construct(boolean isContentTextual, java.lang.Object rawContent, int offset, int length, ErrorReportConfiguration errorReportConfiguration)
- Since:
 - 2.16
 
 
- 
construct
public static ContentReference construct(boolean isContentTextual, java.lang.Object rawContent, ErrorReportConfiguration errorReportConfiguration)
- Since:
 - 2.16
 
 
- 
rawReference
public static ContentReference rawReference(boolean isContentTextual, java.lang.Object rawContent)
Factory method for legacy code to use for constructing instances to content about which only minimal amount of information is available. Assumed not to contain textual content (no snippet displayed).- Parameters:
 isContentTextual- Is raw content assumed to have textual content (true) or binary (false)rawContent- Underlying raw content access- Returns:
 - Instance with minimal information about content (basically just raw content reference without offsets
 
 
- 
rawReference
public static ContentReference rawReference(java.lang.Object rawContent)
 
- 
hasTextualContent
public boolean hasTextualContent()
 
- 
getRawContent
public java.lang.Object getRawContent()
 
- 
contentOffset
public int contentOffset()
 
- 
contentLength
public int contentLength()
 
- 
buildSourceDescription
public java.lang.String buildSourceDescription()
Method for constructing a "source description" when content represented by this reference is read.- Returns:
 - Description constructed
 
 
- 
appendSourceDescription
public java.lang.StringBuilder appendSourceDescription(java.lang.StringBuilder sb)
Method for appending a "source description" when content represented by this reference is read.- Parameters:
 sb- StringBuilder to append description to- Returns:
 - StringBuilder passed as argument (for call chaining)
 
 
- 
equals
public boolean equals(java.lang.Object other)
- Overrides:
 equalsin classjava.lang.Object
 
- 
hashCode
public int hashCode()
- Overrides:
 hashCodein classjava.lang.Object
 
 - 
 
 -