java.lang.Object
swim.codec.Output<T>
swim.codec.OutputBuffer<T>
Non-blocking token stream buffer.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract byte[]
array()
abstract int
abstract int
capacity()
clone()
Returns an implementation-defined branch of the token stream.Writes the code points of the developer-readableDebug
string of the givenobject
.Writes the code points of the human-readableDisplay
string of the givenobject
.static <T> OutputBuffer<T>
done()
Returns anOutputBuffer
in the done state, that binds anull
result.static <T> OutputBuffer<T>
done
(OutputSettings settings) Returns anOutputBuffer
in the done state, with the givensettings
.static <T> OutputBuffer<T>
done
(T value) Returns anOutputBuffer
in the done state, that binds the givenvalue
.static <T> OutputBuffer<T>
done
(T value, OutputSettings settings) Returns anOutputBuffer
in the done state, that binds the givenvalue
, with the givensettings
.static <T> OutputBuffer<T>
Returns anOutputBuffer
in the error state, with the given outputerror
.static <T> OutputBuffer<T>
error
(Throwable error, OutputSettings settings) Returns anOutputBuffer
in the error state, with the given outputerror
andsettings
.flush()
Writes any internally buffered state to the underlying output stream.Returns anOutput
equivalent to thisOutput
, but whose behavior may be altered by the given out-of-bandcondition
.static <T> OutputBuffer<T>
full()
Returns anOutputBuffer
in the full state, that binds anull
result.static <T> OutputBuffer<T>
full
(OutputSettings settings) Returns anOutputBuffer
in the full state, with the givensettings
.static <T> OutputBuffer<T>
full
(T value) Returns anOutputBuffer
in the full state, that binds the givenvalue
.static <T> OutputBuffer<T>
full
(T value, OutputSettings settings) Returns anOutputBuffer
in the full state, that binds the givenvalue
, with the givensettings
.abstract int
get
(int index) abstract boolean
has
(int index) abstract int
index()
abstract OutputBuffer<T>
index
(int index) abstract OutputBuffer<T>
isPart
(boolean isPart) Returns a partialOutput
equivalent to thisOutput
, ifisPart
istrue
; returns a finalOutput
equivalent to thisOutput
ifisPart
isfalse
.abstract int
limit()
abstract OutputBuffer<T>
limit
(int limit) abstract OutputBuffer<T>
move
(int fromIndex, int toIndex, int length) abstract int
abstract void
set
(int index, int token) abstract OutputBuffer<T>
settings
(OutputSettings settings) Updates thesettings
associated with thisOutput
.abstract OutputBuffer<T>
step
(int offset) abstract OutputBuffer<T>
write
(int token) Writes a singletoken
to the stream, if thisOutput
is in the cont state.Writes the code points of the givenstring
.abstract int
write
(ReadableByteChannel channel) writeln()
Writes the code points of thesettings
'line separator
.Writes the code points of the givenstring
, followed by the code points of thesettings
'line separator
.
-
Constructor Details
-
OutputBuffer
public OutputBuffer()
-
-
Method Details
-
isPart
Description copied from class:Output
Returns a partialOutput
equivalent to thisOutput
, ifisPart
istrue
; returns a finalOutput
equivalent to thisOutput
ifisPart
isfalse
. The caller's reference tothis
Output
should be replaced by the returnedOutput
. -
index
public abstract int index() -
index
-
limit
public abstract int limit() -
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) -
write
- Throws:
IOException
-
write
Description copied from class:Output
Writes a singletoken
to the stream, if thisOutput
is in the cont state. Returns anOutput
in the error state if thisOutput
is not in the cont state. The caller's reference tothis
Output
should be replaced by the returnedOutput
. -
write
Description copied from class:Output
Writes the code points of the givenstring
. Assumes this is a UnicodeOutput
with sufficient capacity. Returns anOutput
in the error state if thisOutput
exits the cont state before the fullstring
has been writtem. The caller's reference tothis
Output
should be replaced by the returnedOutput
. -
writeln
Description copied from class:Output
Writes the code points of the givenstring
, followed by the code points of thesettings
'line separator
. Assumes this is a UnicodeOutput
with sufficient capacity. Returns anOutput
in the error state if thisOutput
exits the cont state before the fullstring
and line separator has been written. The caller's reference tothis
Output
should be replaced by the returnedOutput
. -
writeln
Description copied from class:Output
Writes the code points of thesettings
'line separator
. Assumes this is a UnicodeOutput
with sufficient capacity. Returns anOutput
in the error state if thisOutput
exits the cont state before the full line separator has been written. The caller's reference tothis
Output
should be replaced by the returnedOutput
. -
display
Description copied from class:Output
Writes the code points of the human-readableDisplay
string of the givenobject
. Assumes this is a UnicodeOutput
with sufficient capacity. Returns anOutput
in the error state if thisOutput
exits the contt state before the full display string has been written. The caller's reference tothis
Output
should be replaced by the returnedOutput
. -
debug
Description copied from class:Output
Writes the code points of the developer-readableDebug
string of the givenobject
. Assumes this is a UnicodeOutput
with sufficient capacity. Returns anOutput
in the error state if thisOutput
exits the contt state before the full debug string has been written. The caller's reference tothis
Output
should be replaced by the returnedOutput
. -
move
-
step
-
flush
Description copied from class:Output
Writes any internally buffered state to the underlying output stream. -
fork
Description copied from class:Output
Returns anOutput
equivalent to thisOutput
, but whose behavior may be altered by the given out-of-bandcondition
. The caller's reference tothis
Output
should be replaced by the returnedOutput
. -
settings
Description copied from class:Output
Updates thesettings
associated with thisOutput
. -
clone
Description copied from class:Output
Returns an implementation-defined branch of the token stream. -
full
Returns anOutputBuffer
in the full state, that binds anull
result. -
full
Returns anOutputBuffer
in the full state, with the givensettings
. -
full
Returns anOutputBuffer
in the full state, that binds the givenvalue
. -
full
Returns anOutputBuffer
in the full state, that binds the givenvalue
, with the givensettings
. -
done
Returns anOutputBuffer
in the done state, that binds anull
result. -
done
Returns anOutputBuffer
in the done state, with the givensettings
. -
done
Returns anOutputBuffer
in the done state, that binds the givenvalue
. -
done
Returns anOutputBuffer
in the done state, that binds the givenvalue
, with the givensettings
. -
error
Returns anOutputBuffer
in the error state, with the given outputerror
. -
error
Returns anOutputBuffer
in the error state, with the given outputerror
andsettings
.
-