public class DataStreamConsumer extends Object implements DataConsumer
A DataConsumer
which writes the data into an OutputStream
.
Constructor and Description |
---|
DataStreamConsumer(OutputStream out,
String name)
Creates a consumer.
|
Modifier and Type | Method and Description |
---|---|
void |
consume(byte[] buffer,
int length)
Consume the data.
|
String |
getName()
Returns the name of the consumer in the exception (if one is thrown).
|
public DataStreamConsumer(OutputStream out, String name)
Creates a consumer.
out
- The output stream.name
- The name of the handler in the exception (if one is thrown).IllegalArgumentException
- If any of the parameters are null
.public String getName()
DataConsumer
Returns the name of the consumer in the exception (if one is thrown).
getName
in interface DataConsumer
public void consume(byte[] buffer, int length) throws IOException
DataConsumer
Consume the data.
consume
in interface DataConsumer
buffer
- The buffer containing the data.length
- The length which defines how much of the buffer is filled with
data.IOException
- If an I/O error occurs.Copyright © 2015–2019. All rights reserved.