ByteArrayInputStreamNameByteArrayInputStreamSynopsis
DescriptionA ByteArrayInputStream is a stream whose data comes from a byte array. None of the methods of this class throw an IOException because the data comes from an array instead of an actual I/O device. This class does not support the ability to mark a position in the stream. A call to reset(), however, does position the stream at the beginning of the byte array. The position of the end of the stream depends on the constructor used. If the ByteArrayInputStream(byte[] buf) constructor is used, the end of the stream is the end of the byte array. If the ByteArrayInputStream(byte[] buf, int offset, int length) constructor is used, the end of the stream is reached at the index given by offset+length. Class Summary
public class java.io.ByteArrayInputStream extends java.io.InputStream { // Variables protected byte[] buf; protected int count; protected int pos; // Constructors public ByteArrayInputStream(byte[] buf); public ByteArrayInputStream(byte[] buf, int offset, int length); // Instance Methods public synchronized int available(); public synchronized int read(); public synchronized int read(byte[] b, int off, int len); public synchronized void reset(); public synchronized long skip(long n); } Variablesbufprotected byte[] buf
countprotected int count
posprotected int pos
ConstructorsByteArrayInputStreampublic ByteArrayInputStream(byte[] buf)
public ByteArrayInputStream(byte[] buf, int offset, int length)
Instance Methodsavailablepublic synchronized int available()
readpublic synchronized int read()
public synchronized int read(byte[] b, int off, int len)
resetpublic synchronized void reset()
skippublic synchronized long skip(long n)
Inherited Methods
See AlsoInputStream, String |
|