Creates or reinitializes a {@link BinaryEncoder} with the OutputStreamprovided as the destination for written data. If
reuse is provided, an attempt will be made to reconfigure
reuse rather than construct a new instance, but this is not guaranteed, a new instance may be returned.
The {@link BinaryEncoder} implementation returned may buffer its output.Data may not appear on the underlying OutputStream until {@link Encoder#flush()} is called. The buffer size is configured with{@link #configureBufferSize(int)}. If buffering is not desired, and lower performance is acceptable, use {@link #directBinaryEncoder(OutputStream,BinaryEncoder)}
{@link BinaryEncoder} instances returned by this method are not thread-safe
@param out The OutputStream to write to. Cannot be null.
@param reuse The BinaryEncoder to
attempt to reuse given the factory configuration. A BinaryEncoder implementation may not be compatible with reuse, causing a new instance to be returned. If null, a new instance is returned.
@return A BinaryEncoder that uses
out as its data output. If
reuse is null, this will be a new instance. If
reuse is not null, then the returned instance may be a new instance or
reuse reconfigured to use
out.
@throws IOException
@see BufferedBinaryEncoder
@see Encoder