Java in a Nutshell, 5th Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Java in a Nutshell, 5th Edition [Electronic resources] - نسخه متنی

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


StringWriterjava.io

Java 1.1appendable closeable flushable

This class is a
character output stream that uses
an internal StringBuffer object as the destination
of the characters written to the stream. When you create a
StringWriter, you may optionally specify an
initial size for the StringBuffer, but you do not
specify the StringBuffer itself; it is managed
internally by the StringWriter and grows as
necessary to accommodate the characters written to it.
StringWriter defines the standard write(
)
,
flush( ), and close( ) methods
all Writer subclasses define, as well as two
methods to obtain the characters that have been written to the
stream's internal buffer. toString(
)
returns the contents of the internal buffer as a
String, and getBuffer(
) returns the buffer itself. Note
that getBuffer( ) returns a reference to the
actual internal buffer, not a copy of it, so any changes you make to
the buffer are reflected in subsequent calls to toString(
). StringWriter is quite similar to
CharArrayWriter, but does not have a byte-stream
analog.


Figure 9-60. java.io.StringWriter

public class

StringWriter extends Writer {
// Public Constructors
public

StringWriter ( );
public

StringWriter (int

initialSize );
// Public Instance Methods

5.0 public StringWriter

append (CharSequence

csq );

5.0 public StringWriter

append (char

c );

5.0 public StringWriter

append (CharSequence

csq , int

start , int

end );
public StringBuffer

getBuffer ( );
// Public Methods Overriding Writer
public void

close ( ) throws IOException; empty
public void

flush ( ); empty
public void

write (int

c );
public void

write (String

str );
public void

write (String

str , int

off , int

len );
public void

write (char[ ]

cbuf , int

off , int

len );
// Public Methods Overriding Object
public String

toString ( );
}



    / 1191