Name
ByteArrayInputStream
Synopsis
This class is a subclass of
InputStream
in which input data comes from a
specified array of byte
values.
This is useful when you want to read data in memory as if it were
coming from a file, pipe, or socket. Note that the specified array of
bytes is not copied when a ByteArrayInputStream
is
created. See also CharArrayReader
.
Figure 9-5. java.io.ByteArrayInputStream
public class ByteArrayInputStream extends InputStream { // Public Constructors public ByteArrayInputStream(byte[ ] buf); public ByteArrayInputStream(byte[ ] buf, int offset, int length); // Public Methods Overriding InputStream public int available( ); synchronized 1.2 public void close( ) throws IOException; empty 1.1 public void mark(int readAheadLimit); 1.1 public boolean markSupported( ); constant public int read( ); synchronized public int read(byte[ ] b, int off, int len); synchronized public void reset( ); synchronized public long skip(long n); synchronized // Protected Instance Fields protected byte[ ] buf; protected int count; 1.1 protected int mark; protected int pos; }
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.