Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 113
نمايش فراداده

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 ; }