- java.lang.Object
-
- swim.codec.Input
-
- swim.codec.InputBuffer
-
public abstract class InputBuffer extends Input
Non-blocking token stream buffer.
-
-
Constructor Summary
Constructors Constructor Description InputBuffer()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract byte[]
array()
abstract int
arrayOffset()
abstract int
capacity()
abstract InputBuffer
clone()
Returns an independently positioned view into the token stream, initialized with identical state to thisInput
.static InputBuffer
done()
Returns anInputBuffer
in the done state.static InputBuffer
done(Object id, Mark mark)
Returns anInputBuffer
in the done state, at themark
position of a token stream logically identified byid
.static InputBuffer
done(Object id, Mark mark, InputSettings settings)
Returns anInputBuffer
in the done state, at themark
position of a token stream logically identified byid
, with the givensettings
.static InputBuffer
done(InputSettings settings)
Returns anInputBuffer
in the done state, with the givensettings
.static InputBuffer
empty()
Returns anInputBuffer
in the empty state.static InputBuffer
empty(Object id, Mark mark)
Returns anInputBuffer
in the empty state, at themark
position of a token stream logically identified byid
.static InputBuffer
empty(Object id, Mark mark, InputSettings settings)
Returns anInputBuffer
in the empty state, at themark
position of a token stream logically identified byid
, with the givensettings
.static InputBuffer
empty(InputSettings settings)
Returns anInputBuffer
in the empty state, with the givensettings
.static InputBuffer
error(Throwable error)
Returns anInputBuffer
in the error state, with the given inputerror
.static InputBuffer
error(Throwable error, Object id, Mark mark)
Returns anInputBuffer
in the error state, with the given inputerror
, at themark
position of a token stream logically identified byid
.static InputBuffer
error(Throwable error, Object id, Mark mark, InputSettings settings)
Returns anInputBuffer
in the error state, with the given inputerror
, at themark
position of a token stream logically identified byid
, with the givensettings
.static InputBuffer
error(Throwable error, InputSettings settings)
Returns anInputBuffer
in the error state, with the given inputerror
andsettings
.InputBuffer
fork(Object condition)
Returns anInput
equivalent to thisInput
, but whose behavior may be altered by the given out-of-bandcondition
.abstract int
get(int index)
abstract boolean
has(int index)
abstract InputBuffer
id(Object id)
Returns anInput
equivalent to thisInput
, but logically identified by the given–possiblynull
–id
.abstract int
index()
abstract InputBuffer
index(int index)
abstract InputBuffer
isPart(boolean isPart)
Returns a partialInput
equivalent to thisInput
, ifisPart
istrue
; returns a finalInput
equivalent to thisInput
ifisPart
isfalse
.abstract int
limit()
abstract InputBuffer
limit(int limit)
abstract InputBuffer
mark(Mark mark)
Returns anInput
equivalent to thisInput
, but logically positioned at the givenmark
.abstract int
remaining()
abstract InputBuffer
seek(Mark mark)
Returns anInput
equivalent to thisInput
, but repositioned to the givenmark
.abstract void
set(int index, int token)
abstract InputBuffer
settings(InputSettings settings)
Returns anInput
equivalent to thisInput
, but with the given inputsettings
.abstract InputBuffer
step()
Returns anInput
equivalent to thisInput
, but advanced to the next token.abstract InputBuffer
step(int offset)
-
-
-
Method Detail
-
isPart
public abstract InputBuffer isPart(boolean isPart)
Description copied from class:Input
Returns a partialInput
equivalent to thisInput
, ifisPart
istrue
; returns a finalInput
equivalent to thisInput
ifisPart
isfalse
. The caller's reference tothis
Input
should be replaced by the returnedInput
.
-
index
public abstract int index()
-
index
public abstract InputBuffer index(int index)
-
limit
public abstract int limit()
-
limit
public abstract InputBuffer limit(int limit)
-
capacity
public abstract int capacity()
-
remaining
public abstract int remaining()
-
array
public abstract byte[] array()
-
arrayOffset
public abstract int arrayOffset()
-
has
public abstract boolean has(int index)
-
get
public abstract int get(int index)
-
set
public abstract void set(int index, int token)
-
step
public abstract InputBuffer step()
Description copied from class:Input
Returns anInput
equivalent to thisInput
, but advanced to the next token. Returns anInput
in the error state if thisInput
is not in the cont state. The caller's reference tothis
Input
should be replaced by the returnedInput
.
-
step
public abstract InputBuffer step(int offset)
-
seek
public abstract InputBuffer seek(Mark mark)
Description copied from class:Input
Returns anInput
equivalent to thisInput
, but repositioned to the givenmark
. Returns anInput
in the error state if thisInput
does not support seeking, or if thisInput
is unable to reposition to the givenmark
. The caller's reference tothis
Input
should be replaced by the returnedInput
.
-
fork
public InputBuffer fork(Object condition)
Description copied from class:Input
Returns anInput
equivalent to thisInput
, but whose behavior may be altered by the given out-of-bandcondition
. The caller's reference tothis
Input
should be replaced by the returnedInput
.
-
id
public abstract InputBuffer id(Object id)
Description copied from class:Input
Returns anInput
equivalent to thisInput
, but logically identified by the given–possiblynull
–id
. The caller's reference tothis
Input
should be replaced by the returnedInput
.
-
mark
public abstract InputBuffer mark(Mark mark)
Description copied from class:Input
Returns anInput
equivalent to thisInput
, but logically positioned at the givenmark
. The physical position in the input stream is not modified. The caller's reference tothis
Input
should be replaced by the returnedInput
.
-
settings
public abstract InputBuffer settings(InputSettings settings)
Description copied from class:Input
Returns anInput
equivalent to thisInput
, but with the given inputsettings
. The caller's reference tothis
Input
should be replaced by the returnedInput
.
-
clone
public abstract InputBuffer clone()
Description copied from class:Input
Returns an independently positioned view into the token stream, initialized with identical state to thisInput
.
-
empty
public static InputBuffer empty()
Returns anInputBuffer
in the empty state.
-
empty
public static InputBuffer empty(InputSettings settings)
Returns anInputBuffer
in the empty state, with the givensettings
.
-
empty
public static InputBuffer empty(Object id, Mark mark)
Returns anInputBuffer
in the empty state, at themark
position of a token stream logically identified byid
.
-
empty
public static InputBuffer empty(Object id, Mark mark, InputSettings settings)
Returns anInputBuffer
in the empty state, at themark
position of a token stream logically identified byid
, with the givensettings
.
-
done
public static InputBuffer done()
Returns anInputBuffer
in the done state.
-
done
public static InputBuffer done(InputSettings settings)
Returns anInputBuffer
in the done state, with the givensettings
.
-
done
public static InputBuffer done(Object id, Mark mark)
Returns anInputBuffer
in the done state, at themark
position of a token stream logically identified byid
.
-
done
public static InputBuffer done(Object id, Mark mark, InputSettings settings)
Returns anInputBuffer
in the done state, at themark
position of a token stream logically identified byid
, with the givensettings
.
-
error
public static InputBuffer error(Throwable error)
Returns anInputBuffer
in the error state, with the given inputerror
.
-
error
public static InputBuffer error(Throwable error, InputSettings settings)
Returns anInputBuffer
in the error state, with the given inputerror
andsettings
.
-
error
public static InputBuffer error(Throwable error, Object id, Mark mark)
Returns anInputBuffer
in the error state, with the given inputerror
, at themark
position of a token stream logically identified byid
.
-
error
public static InputBuffer error(Throwable error, Object id, Mark mark, InputSettings settings)
Returns anInputBuffer
in the error state, with the given inputerror
, at themark
position of a token stream logically identified byid
, with the givensettings
.
-
-