- java.lang.Object
-
- swim.codec.Output<T>
-
- swim.codec.OutputBuffer<T>
-
public abstract class OutputBuffer<T> extends Output<T>
Non-blocking token stream buffer.
-
-
Constructor Summary
Constructors Constructor Description OutputBuffer()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract byte[]array()abstract intarrayOffset()abstract intcapacity()OutputBuffer<T>clone()Returns an implementation-defined branch of the token stream.OutputBuffer<T>debug(Object object)Writes the code points of the developer-readableDebugstring of the givenobject.OutputBuffer<T>display(Object object)Writes the code points of the human-readableDisplaystring of the givenobject.static <T> OutputBuffer<T>done()Returns anOutputBufferin the done state, that binds anullresult.static <T> OutputBuffer<T>done(OutputSettings settings)Returns anOutputBufferin the done state, with the givensettings.static <T> OutputBuffer<T>done(T value)Returns anOutputBufferin the done state, that binds the givenvalue.static <T> OutputBuffer<T>done(T value, OutputSettings settings)Returns anOutputBufferin the done state, that binds the givenvalue, with the givensettings.static <T> OutputBuffer<T>error(Throwable error)Returns anOutputBufferin the error state, with the given outputerror.static <T> OutputBuffer<T>error(Throwable error, OutputSettings settings)Returns anOutputBufferin the error state, with the given outputerrorandsettings.OutputBuffer<T>flush()Writes any internally buffered state to the underlying output stream.OutputBuffer<T>fork(Object condition)Returns anOutputequivalent to thisOutput, but whose behavior may be altered by the given out-of-bandcondition.static <T> OutputBuffer<T>full()Returns anOutputBufferin the full state, that binds anullresult.static <T> OutputBuffer<T>full(OutputSettings settings)Returns anOutputBufferin the full state, with the givensettings.static <T> OutputBuffer<T>full(T value)Returns anOutputBufferin the full state, that binds the givenvalue.static <T> OutputBuffer<T>full(T value, OutputSettings settings)Returns anOutputBufferin the full state, that binds the givenvalue, with the givensettings.abstract intget(int index)abstract booleanhas(int index)abstract intindex()abstract OutputBuffer<T>index(int index)abstract OutputBuffer<T>isPart(boolean isPart)Returns a partialOutputequivalent to thisOutput, ifisPartistrue; returns a finalOutputequivalent to thisOutputifisPartisfalse.abstract intlimit()abstract OutputBuffer<T>limit(int limit)abstract OutputBuffer<T>move(int fromIndex, int toIndex, int length)abstract intremaining()abstract voidset(int index, int token)abstract OutputBuffer<T>settings(OutputSettings settings)Updates thesettingsassociated with thisOutput.abstract OutputBuffer<T>step(int offset)abstract OutputBuffer<T>write(int token)Writes a singletokento the stream, if thisOutputis in the cont state.OutputBuffer<T>write(String string)Writes the code points of the givenstring.abstract intwrite(ReadableByteChannel channel)OutputBuffer<T>writeln()Writes the code points of thesettings'line separator.OutputBuffer<T>writeln(String string)Writes the code points of the givenstring, followed by the code points of thesettings'line separator.
-
-
-
Method Detail
-
isPart
public abstract OutputBuffer<T> isPart(boolean isPart)
Description copied from class:OutputReturns a partialOutputequivalent to thisOutput, ifisPartistrue; returns a finalOutputequivalent to thisOutputifisPartisfalse. The caller's reference tothisOutputshould be replaced by the returnedOutput.
-
index
public abstract int index()
-
index
public abstract OutputBuffer<T> index(int index)
-
limit
public abstract int limit()
-
limit
public abstract OutputBuffer<T> 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)
-
write
public abstract int write(ReadableByteChannel channel) throws IOException
- Throws:
IOException
-
write
public abstract OutputBuffer<T> write(int token)
Description copied from class:OutputWrites a singletokento the stream, if thisOutputis in the cont state. Returns anOutputin the error state if thisOutputis not in the cont state. The caller's reference tothisOutputshould be replaced by the returnedOutput.
-
write
public OutputBuffer<T> write(String string)
Description copied from class:OutputWrites the code points of the givenstring. Assumes this is a UnicodeOutputwith sufficient capacity. Returns anOutputin the error state if thisOutputexits the cont state before the fullstringhas been writtem. The caller's reference tothisOutputshould be replaced by the returnedOutput.
-
writeln
public OutputBuffer<T> writeln(String string)
Description copied from class:OutputWrites the code points of the givenstring, followed by the code points of thesettings'line separator. Assumes this is a UnicodeOutputwith sufficient capacity. Returns anOutputin the error state if thisOutputexits the cont state before the fullstringand line separator has been written. The caller's reference tothisOutputshould be replaced by the returnedOutput.
-
writeln
public OutputBuffer<T> writeln()
Description copied from class:OutputWrites the code points of thesettings'line separator. Assumes this is a UnicodeOutputwith sufficient capacity. Returns anOutputin the error state if thisOutputexits the cont state before the full line separator has been written. The caller's reference tothisOutputshould be replaced by the returnedOutput.
-
display
public OutputBuffer<T> display(Object object)
Description copied from class:OutputWrites the code points of the human-readableDisplaystring of the givenobject. Assumes this is a UnicodeOutputwith sufficient capacity. Returns anOutputin the error state if thisOutputexits the contt state before the full display string has been written. The caller's reference tothisOutputshould be replaced by the returnedOutput.
-
debug
public OutputBuffer<T> debug(Object object)
Description copied from class:OutputWrites the code points of the developer-readableDebugstring of the givenobject. Assumes this is a UnicodeOutputwith sufficient capacity. Returns anOutputin the error state if thisOutputexits the contt state before the full debug string has been written. The caller's reference tothisOutputshould be replaced by the returnedOutput.
-
move
public abstract OutputBuffer<T> move(int fromIndex, int toIndex, int length)
-
step
public abstract OutputBuffer<T> step(int offset)
-
flush
public OutputBuffer<T> flush()
Description copied from class:OutputWrites any internally buffered state to the underlying output stream.
-
fork
public OutputBuffer<T> fork(Object condition)
Description copied from class:OutputReturns anOutputequivalent to thisOutput, but whose behavior may be altered by the given out-of-bandcondition. The caller's reference tothisOutputshould be replaced by the returnedOutput.
-
settings
public abstract OutputBuffer<T> settings(OutputSettings settings)
Description copied from class:OutputUpdates thesettingsassociated with thisOutput.
-
clone
public OutputBuffer<T> clone()
Description copied from class:OutputReturns an implementation-defined branch of the token stream.
-
full
public static <T> OutputBuffer<T> full()
Returns anOutputBufferin the full state, that binds anullresult.
-
full
public static <T> OutputBuffer<T> full(OutputSettings settings)
Returns anOutputBufferin the full state, with the givensettings.
-
full
public static <T> OutputBuffer<T> full(T value)
Returns anOutputBufferin the full state, that binds the givenvalue.
-
full
public static <T> OutputBuffer<T> full(T value, OutputSettings settings)
Returns anOutputBufferin the full state, that binds the givenvalue, with the givensettings.
-
done
public static <T> OutputBuffer<T> done()
Returns anOutputBufferin the done state, that binds anullresult.
-
done
public static <T> OutputBuffer<T> done(OutputSettings settings)
Returns anOutputBufferin the done state, with the givensettings.
-
done
public static <T> OutputBuffer<T> done(T value)
Returns anOutputBufferin the done state, that binds the givenvalue.
-
done
public static <T> OutputBuffer<T> done(T value, OutputSettings settings)
Returns anOutputBufferin the done state, that binds the givenvalue, with the givensettings.
-
error
public static <T> OutputBuffer<T> error(Throwable error)
Returns anOutputBufferin the error state, with the given outputerror.
-
error
public static <T> OutputBuffer<T> error(Throwable error, OutputSettings settings)
Returns anOutputBufferin the error state, with the given outputerrorandsettings.
-
-