java.lang.Object |
↳ |
java.io.OutputStream |
|
↳ |
java.io.ByteArrayOutputStream |
|
|
↳ |
com.pnfsoftware.jeb.util.io.DirectByteArrayOutputStream |
Class Overview
Extend ByteArrayOutputStream to provide direct access to the underlying byte array. In
particular, this class is meant to circumvent the memory consumption issues of
toByteArray()
.
Summary
[Expand]
Inherited Fields |
From class
java.io.ByteArrayOutputStream
protected
byte[] |
buf |
|
protected
int |
count |
|
|
Public Methods |
synchronized
ByteBuffer
|
getBytes()
Direct access to the underlying byte array.
|
byte[]
|
getRawBytes()
Direct access to the underlying byte array.
|
[Expand]
Inherited Methods |
From class
java.io.ByteArrayOutputStream
void
|
close()
|
synchronized
void
|
reset()
|
synchronized
int
|
size()
|
synchronized
byte[]
|
toByteArray()
|
synchronized
String
|
toString(String arg0)
|
synchronized
String
|
toString(Charset arg0)
|
synchronized
String
|
toString()
|
synchronized
String
|
toString(int arg0)
|
synchronized
void
|
write(byte[] arg0, int arg1, int arg2)
|
synchronized
void
|
write(int arg0)
|
void
|
writeBytes(byte[] arg0)
|
synchronized
void
|
writeTo(OutputStream arg0)
|
|
From class
java.io.OutputStream
void
|
close()
|
void
|
flush()
|
static
OutputStream
|
nullOutputStream()
|
void
|
write(byte[] arg0)
|
void
|
write(byte[] arg0, int arg1, int arg2)
|
abstract
void
|
write(int arg0)
|
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
From interface
java.io.Closeable
|
From interface
java.io.Flushable
|
From interface
java.lang.AutoCloseable
|
Public Constructors
public
DirectByteArrayOutputStream
()
Public Methods
public
synchronized
ByteBuffer
getBytes
()
Direct access to the underlying byte array.
Returns
- a buffer view of the bytes written to the stream
public
byte[]
getRawBytes
()
Direct access to the underlying byte array. This method is dangerous, but can be used instead
of the expensive toByteArray()
. It should be used in combination with
size()
. A safer, as efficient alternative, is getBytes()
.
Returns
- array with potentially more bytes than what was actually written to the stream (see
size()
)