public abstract class OutputBuffer extends OutputStream
Constructor and Description |
---|
OutputBuffer() |
Modifier and Type | Method and Description |
---|---|
String |
asString()
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
String |
asString(String encoding)
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
void |
backpatchSize(int size)
Backpatches the size of a document or string by writing the size into the four bytes starting at getPosition() -
size.
|
protected void |
backpatchSize(int size,
int additionalOffset)
Backpatches the size of a document or string by writing the size into the four bytes starting at
getPosition() - size -
additionalOffset . |
abstract int |
getPosition() |
String |
hex()
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
String |
md5()
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
abstract int |
pipe(OutputStream out) |
abstract void |
seekEnd()
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
abstract void |
seekStart()
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
abstract void |
setPosition(int position)
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
abstract int |
size() |
byte[] |
toByteArray()
mostly for testing
|
String |
toString() |
void |
truncateToPosition(int newPosition)
Truncates the buffer to the given new position, which must be greater than or equal to zero and less than or equal to the current
size of this buffer.
|
abstract void |
write(byte[] b) |
abstract void |
write(byte[] b,
int off,
int len) |
abstract void |
write(int b) |
int |
writeCString(String str)
Writes C string (null-terminated string) to underlying buffer.
|
void |
writeDouble(double x) |
void |
writeInt(int x) |
void |
writeInt(int pos,
int x)
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
void |
writeIntBE(int x)
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
void |
writeLong(long x) |
void |
writeString(String str) |
close, flush
public abstract void write(byte[] b)
write
in class OutputStream
public abstract void write(byte[] b, int off, int len)
write
in class OutputStream
public abstract void write(int b)
write
in class OutputStream
public abstract int getPosition()
@Deprecated public abstract void setPosition(int position)
@Deprecated public abstract void seekEnd()
@Deprecated public abstract void seekStart()
public abstract int size()
public abstract int pipe(OutputStream out) throws IOException
IOException
public byte[] toByteArray()
@Deprecated public String asString()
@Deprecated public String asString(String encoding) throws UnsupportedEncodingException
UnsupportedEncodingException
@Deprecated public String hex()
@Deprecated public String md5()
public void writeInt(int x)
@Deprecated public void writeIntBE(int x)
@Deprecated public void writeInt(int pos, int x)
public void writeLong(long x)
public void writeDouble(double x)
public void writeString(String str)
public int writeCString(String str)
str
- the stringpublic void backpatchSize(int size)
size
- the size of the document/stringprotected void backpatchSize(int size, int additionalOffset)
getPosition() - size -
additionalOffset
.size
- the size of the document/stringadditionalOffset
- the offset from the current position to write the sizepublic void truncateToPosition(int newPosition)
newPosition
- the position to truncate this buffer to