@Authors(value="Nikolche Mihajlovski") @Since(value="2.0.0") public class MultiBuf extends OutputStream implements Buf, org.rapidoid.util.Constants
INCOMPLETE_READAMP, ANY, ASTERISK, BYTE_0, COL, CR, CR_, CR_LF, CR_LF_CR_LF, DELETE, EMPTY_ARRAY, EMPTY_STRING_ARRAY, EQ, F, GET, GET_OR_POST, HEAD, HTTP_VERBS, LAST_6, LF, LF_, LF_LF, MALFORMED_CHAR, NOT_FOUND, OPTIONS, PATCH, POST, PUT, SEMI_COL, SEPARATOR_LINE, SPACE, SPACE_, T, TRACE, UTF8_2_BYTES_LEAD, UTF8_3_BYTES_LEAD, UTF8_4_BYTES_LEAD, UTF8_CONTINUATION| Constructor and Description |
|---|
MultiBuf(org.rapidoid.pool.Pool<ByteBuffer> bufPool,
int factor,
String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
append(byte value) |
void |
append(byte[] bytes) |
void |
append(byte[] src,
int offset,
int length) |
void |
append(ByteArrayOutputStream src) |
void |
append(ByteBuffer src) |
int |
append(ReadableByteChannel channel)
Reads data from the channel and appends it to the buffer.
|
int |
append(String s) |
OutputStream |
asOutputStream() |
String |
asText() |
void |
back(int count) |
ByteBuffer |
bufAt(int index) |
int |
bufCount() |
int |
bufferIndexOf(int position) |
int |
bufferOffsetOf(int position) |
Bytes |
bytes() |
int |
checkpoint() |
void |
checkpoint(int checkpoint) |
void |
clear() |
String |
data() |
void |
deleteAfter(int position) |
void |
deleteBefore(int count) |
void |
deleteLast(int count) |
ByteBuffer |
exposed() |
ByteBuffer |
first() |
String |
get(BufRange range) |
void |
get(BufRange range,
byte[] dest,
int offset) |
byte |
get(int position) |
long |
getN(BufRange range) |
ByteBuffer |
getSingle() |
boolean |
hasRemaining() |
boolean |
isSingle() |
int |
limit() |
void |
limit(int limit) |
byte |
next() |
byte |
peek() |
int |
position() |
void |
position(int position) |
void |
put(int position,
byte value) |
void |
put(int position,
byte[] bytes,
int offset,
int length) |
int |
putNumAsText(int position,
long n,
boolean forward) |
String |
readLn() |
String |
readN(int count) |
byte[] |
readNbytes(int count) |
int |
remaining() |
void |
scanLn(BufRange line) |
void |
scanLnLn(BufRanges lines) |
void |
scanLnLn(BufRanges ranges,
org.rapidoid.wrap.IntWrap result,
byte end1,
byte end2) |
void |
scanN(int count,
BufRange range) |
void |
scanTo(byte sep,
BufRange range,
boolean failOnLimit) |
int |
scanTo(byte sep1,
byte sep2,
BufRange range,
boolean failOnLimit) |
void |
scanUntil(byte value,
BufRange range) |
void |
scanWhile(byte value,
BufRange range) |
void |
setReadOnly(boolean readOnly) |
int |
size() |
void |
skip(int count) |
String |
toString() |
int |
unitCount() |
int |
unitSize() |
Buf |
unwrap() |
void |
upto(byte value,
BufRange range) |
void |
write(byte[] src,
int off,
int len) |
void |
write(int byteValue) |
int |
writeTo(ByteBuffer buffer) |
int |
writeTo(ByteBuffer buffer,
int srcOffset,
int length) |
int |
writeTo(WritableByteChannel channel) |
int |
writeTo(WritableByteChannel channel,
int srcOffset,
int length) |
close, flush, writepublic MultiBuf(org.rapidoid.pool.Pool<ByteBuffer> bufPool, int factor, String name)
public int append(ReadableByteChannel channel) throws IOException
Precondition: received event that the channel has data to be read.
append in interface BufIOExceptionpublic void append(ByteBuffer src)
public ByteBuffer first()
public ByteBuffer bufAt(int index)
public int writeTo(WritableByteChannel channel) throws IOException
writeTo in interface BufIOExceptionpublic int writeTo(WritableByteChannel channel, int srcOffset, int length) throws IOException
writeTo in interface BufIOExceptionpublic int writeTo(ByteBuffer buffer)
public int writeTo(ByteBuffer buffer, int srcOffset, int length)
public void deleteBefore(int count)
deleteBefore in interface Bufpublic void put(int position,
byte[] bytes,
int offset,
int length)
public void deleteAfter(int position)
deleteAfter in interface Bufpublic void deleteLast(int count)
deleteLast in interface Bufpublic ByteBuffer getSingle()
public int putNumAsText(int position,
long n,
boolean forward)
putNumAsText in interface Bufpublic boolean hasRemaining()
hasRemaining in interface Bufpublic ByteBuffer exposed()
public void scanUntil(byte value,
BufRange range)
public void scanWhile(byte value,
BufRange range)
public int bufferIndexOf(int position)
bufferIndexOf in interface Bufpublic int bufferOffsetOf(int position)
bufferOffsetOf in interface Bufpublic OutputStream asOutputStream()
asOutputStream in interface Bufpublic byte[] readNbytes(int count)
readNbytes in interface Bufpublic void scanTo(byte sep,
BufRange range,
boolean failOnLimit)
public int scanTo(byte sep1,
byte sep2,
BufRange range,
boolean failOnLimit)
public void scanLnLn(BufRanges ranges, org.rapidoid.wrap.IntWrap result, byte end1, byte end2)
public void setReadOnly(boolean readOnly)
setReadOnly in interface Bufpublic int checkpoint()
checkpoint in interface Bufpublic void checkpoint(int checkpoint)
checkpoint in interface Bufpublic void write(int byteValue)
throws IOException
write in interface Bufwrite in class OutputStreamIOExceptionpublic void write(byte[] src,
int off,
int len)
throws IOException
write in interface Bufwrite in class OutputStreamIOExceptionpublic void append(ByteArrayOutputStream src)
Copyright © 2014–2017 Nikolche Mihajlovski and contributors. All rights reserved.