22.18
java.io.ByteArrayOutputStream
THE PACKAGE JAVA.IO
22.18.4
public ByteArrayOutputStream(int size)
This constructor initializes a newly created
ByteArrayOutputStream
 so that its
internal buffer array has length
size
. This matters only for reasons of efficiency;
the buffer array is replaced by a larger one whenever necessary to accommodate
additional bytes written to the stream.
22.18.5
public void write(int b)
One byte is added on the internal buffer. The byte to be added is the eight low 
order bits of the argument
n
. The 24 high order bits of
n
 are ignored.
Implements the
write
 method of
OutputStream
 ( 22.15.1).
22.18.6
public void write(byte[] b, int off, int len)
throws NullPointerException,
IndexOutOfBoundsException
Elements
b[off]
 through
b[off+len 1]
 are appended to the internal buffer.
If
b
 is
null
, a
NullPointerException
 is thrown.
If
off
 is negative, or
len
 is negative, or
off+len
 is greater than the length of
the array
b
, then an
IndexOutOfBoundsException
 is thrown.
Overrides the
write
 method of
OutputStream
 ( 22.15.3).
22.18.7
public int size()
The current value of
count
 is returned.
22.18.8
public void reset()
The internal variable
count
 is reset to zero, thereby logically discarding all bytes
written to the stream so far. However, the internal buffer array, which may be quite
large, remains as it is.
22.18.9
public byte[] toByteArray()
A new array of bytes is created and returned. Its length is equal to the current
value of
count
. Its initial contents are copies of the bytes written to the stream so
far that is, elements
0
 through
count 1
 of
buf
.
728






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved