# Class: com.pnfsoftware.jeb.util.io.DirectByteArrayOutputStream

Extend [ByteArrayOutputStream](ByteArrayOutputStream) to provide direct access to the underlying byte array. In particular, this class is meant to circumvent the memory consumption issues of [#toByteArray()](#toByteArray()).

## Constructor: DirectByteArrayOutputStream


## Method: getBytes
- return type: `java.nio.ByteBuffer`

Description: Direct access to the underlying byte array.
return: a buffer view of the bytes written to the stream

## Method: getRawBytes
- return type: `byte[]`

Description: Direct access to the underlying byte array. This method is dangerous, but can be used instead of the expensive [#toByteArray()](#toByteArray()). It should be used in combination with [#size()](#size()). A safer, as efficient alternative, is [#getBytes()](#getBytes()).
return: array with potentially more bytes than what was actually written to the stream \(see         [#size()](#size())\)

