public class DataStreamProducer extends Object implements DataProducer
A DataProducer
which reads the data from an InputStream
.
Constructor and Description |
---|
DataStreamProducer(InputStream in,
String name)
Creates a producer.
|
Modifier and Type | Method and Description |
---|---|
String |
getName()
Returns the name of the producer in the exception (if one is thrown).
|
int |
produce(byte[] buffer)
Produces the data.
|
public DataStreamProducer(InputStream in, String name)
Creates a producer.
in
- The input stream.name
- The name of the producer in the exception (if one is thrown).IllegalArgumentException
- If any of the parameters are null
.public String getName()
DataProducer
Returns the name of the producer in the exception (if one is thrown).
getName
in interface DataProducer
public int produce(byte[] buffer) throws IOException
DataProducer
Produces the data.
produce
in interface DataProducer
buffer
- The buffer which is filled with the data.-1
, if the end of the produced data is reached.IOException
- If an I/O error occurs.Copyright © 2015–2019. All rights reserved.