@InterfaceAudience.Private @InterfaceStability.Evolving public class ByteSlot extends OutputStream
ByteSlot slot = new ByteSlot();
// write data
slot.write(...);
slot.write(...);
// write header with the size of the written data
slot.markHead();
slot.write(Bytes.toBytes(slot.size()));
// flush to stream as [header, data]
slot.writeTo(stream);
| 构造器和说明 |
|---|
ByteSlot() |
public void reset()
public void markHead()
public int getHead()
public int size()
public byte[] getBuffer()
public void writeAt(int offset,
int b)
public void write(int b)
write 在类中 OutputStreampublic void write(byte[] b,
int off,
int len)
write 在类中 OutputStreampublic void writeTo(OutputStream stream) throws IOException
IOExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.