Package org.apache.iotdb.tsfile.utils
Class PublicBAOS
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.ByteArrayOutputStream
-
- org.apache.iotdb.tsfile.utils.PublicBAOS
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class PublicBAOS extends java.io.ByteArrayOutputStreamA subclass extendingByteArrayOutputStream. It's used to return the byte array directly. Note that the size of byte array is large than actual size of valid contents, thus it's used cooperating withsize()orcapacity = size
-
-
Constructor Summary
Constructors Constructor Description PublicBAOS()PublicBAOS(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getBuf()get current all bytes datavoidreset()It's not a thread-safe method.intsize()The synchronized keyword in this function is intentionally removed.voidtruncate(int size)voidwriteTo(java.io.OutputStream out)It's not a thread-safe method.
-
-
-
Method Detail
-
getBuf
public byte[] getBuf()
get current all bytes data- Returns:
- all bytes data
-
writeTo
public void writeTo(java.io.OutputStream out) throws java.io.IOExceptionIt's not a thread-safe method. Override the super class's implementation. Remove the synchronized key word, to save the synchronization overhead.Writes the complete contents of this byte array output stream to the specified output stream argument, as if by calling the output stream's write method using
out.write(buf, 0, count).- Overrides:
writeToin classjava.io.ByteArrayOutputStream- Parameters:
out- the output stream to which to write the data.- Throws:
java.io.IOException- if an I/O error occurs.
-
reset
public void reset()
It's not a thread-safe method. Override the super class's implementation. Remove the synchronized key word, to save the synchronization overhead.Resets the
countfield of this byte array output stream to zero, so that all currently accumulated output in the output stream is discarded. The output stream can be used again, reusing the already allocated buffer space.- Overrides:
resetin classjava.io.ByteArrayOutputStream
-
size
public int size()
The synchronized keyword in this function is intentionally removed. For details, see https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=173085039- Overrides:
sizein classjava.io.ByteArrayOutputStream
-
truncate
public void truncate(int size)
-
-