THE PACKAGE JAVA.IO
java.io.ByteArrayOutputStream
22.18
22.18.10
public String toString()
A new
String
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
, zero extended to produce characters.
Thus,
tostring()
has the same effect as
toString(0)
( 22.18.11).
Overrides the
toString
method of
Object
( 20.1.2).
22.18.11
public String toString(int hibyte)
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
with
hibyte
supplying the
high order eight bits of each character. Thus, character
k
of the result is equal to:
((hibyte & 0xff) << 8) | (buf[k] & 0xff)
See the
String
constructor that accepts a
hibyte
argument ( 20.12.6).
22.18.12
public void writeTo(OutputStream out) throws IOException
The current contents of the internal buffer are written to the output stream
out
by
the call:
out.write(buf, 0, count)
Note that if
out
is the same as
this
, the effect is simply to append to the buffer a
copy of its current contents, thereby doubling the number of buffered bytes. This
may not be a particularly useful effect; the point is merely that the operation does
terminate, having had a sensible effect, rather than running off into an endless
loop.
729
footer
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