Top Description Fields Constructors Methods
com.fasterxml.jackson.core.io

public abstract Class InputDecorator

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.*

Handler class that can be used to decorate input sources. Typical use is to use a filter abstraction (filtered stream, reader) around original input source, and apply additional processing during read operations.

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract InputStream

Returns:

InputStream to use; either 'in' as is, or decorator version that typically delogates to 'in'
decorate
(IOContext
IO context in use (provides access to declared encoding).

Note

at this point context may not have all information initialized; specifically auto-detected encoding is only available once parsing starts, which may occur only after this method is called.

ctxt
,
InputStream
Original input source
in
)

Method called by com.fasterxml.jackson.core.JsonFactory instance when creating parser given an InputStream, when this decorator has been registered.

public abstract InputStream

Returns:

Either InputStream to use as input source; or null to indicate that contents are to be processed as-is by caller
decorate
(IOContext
IO context in use (provides access to declared encoding) NOTE: at this point context may not have all information initialized; specifically auto-detected encoding is only available once parsing starts, which may occur only after this method is called.
ctxt
,
byte[]
Input buffer that contains contents to parse
src
,
int
Offset of the first available byte in the input buffer
offset
,
int
Number of bytes available in the input buffer
length
)

Method called by com.fasterxml.jackson.core.JsonFactory instance when creating parser on given "raw" byte source.

public DataInput

Returns:

InputStream to use; either 'input' as is, or decorator version that typically delogates to 'input'
decorate
(IOContext
IO context in use (provides access to declared encoding).

Note

at this point context may not have all information initialized; specifically auto-detected encoding is only available once parsing starts, which may occur only after this method is called.

ctxt
,
DataInput
Original input source
input
)

Method called by com.fasterxml.jackson.core.JsonFactory instance when creating parser given an DataInput, when this decorator has been registered.

public abstract Reader

Returns:

Reader to use; either passed in argument, or something that calls it (for example, a FilterReader)
decorate
(IOContext
IO context in use (provides access to declared encoding) NOTE: at this point context may not have all information initialized; specifically auto-detected encoding is only available once parsing starts, which may occur only after this method is called.
ctxt
,
Reader
Original reader
r
)

Method called by com.fasterxml.jackson.core.JsonFactory instance when creating parser given an Reader, when this decorator has been registered.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

InputDecoratorback to summary
public InputDecorator()

Method Detail

decorateback to summary
public abstract InputStream decorate(IOContext ctxt, InputStream in) throws IOException

Method called by com.fasterxml.jackson.core.JsonFactory instance when creating parser given an InputStream, when this decorator has been registered.

Parameters
ctxt:IOContext

IO context in use (provides access to declared encoding).

Note

at this point context may not have all information initialized; specifically auto-detected encoding is only available once parsing starts, which may occur only after this method is called.

in:InputStream

Original input source

Returns:InputStream

InputStream to use; either 'in' as is, or decorator version that typically delogates to 'in'

Exceptions
IOException:
if construction of InputStream fails
decorateback to summary
public abstract InputStream decorate(IOContext ctxt, byte[] src, int offset, int length) throws IOException

Method called by com.fasterxml.jackson.core.JsonFactory instance when creating parser on given "raw" byte source. Method can either construct a InputStream for reading; or return null to indicate that no wrapping should occur.

Parameters
ctxt:IOContext

IO context in use (provides access to declared encoding) NOTE: at this point context may not have all information initialized; specifically auto-detected encoding is only available once parsing starts, which may occur only after this method is called.

src:byte[]

Input buffer that contains contents to parse

offset:int

Offset of the first available byte in the input buffer

length:int

Number of bytes available in the input buffer

Returns:InputStream

Either InputStream to use as input source; or null to indicate that contents are to be processed as-is by caller

Exceptions
IOException:
if construction of InputStream fails
decorateback to summary
public DataInput decorate(IOContext ctxt, DataInput input) throws IOException

Method called by com.fasterxml.jackson.core.JsonFactory instance when creating parser given an DataInput, when this decorator has been registered.

Default implementation simply throws UnsupportedOperationException

Parameters
ctxt:IOContext

IO context in use (provides access to declared encoding).

Note

at this point context may not have all information initialized; specifically auto-detected encoding is only available once parsing starts, which may occur only after this method is called.

input:DataInput

Original input source

Returns:DataInput

InputStream to use; either 'input' as is, or decorator version that typically delogates to 'input'

Exceptions
IOException:
if construction of DataInput fails
Since
2.8
decorateback to summary
public abstract Reader decorate(IOContext ctxt, Reader r) throws IOException

Method called by com.fasterxml.jackson.core.JsonFactory instance when creating parser given an Reader, when this decorator has been registered.

Parameters
ctxt:IOContext

IO context in use (provides access to declared encoding) NOTE: at this point context may not have all information initialized; specifically auto-detected encoding is only available once parsing starts, which may occur only after this method is called.

r:Reader

Original reader

Returns:Reader

Reader to use; either passed in argument, or something that calls it (for example, a FilterReader)

Exceptions
IOException:
if construction of Reader fails