KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > io > StringWriter

java.io
Class StringWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.StringWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable
See Also:
Top Examples, Source Code

public StringWriter append(char c)
See Also:
Writer, Appendable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public StringWriter append(CharSequence csq)
See Also:
Writer, Appendable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public StringWriter append(CharSequence csq,
                           int start,
                           int end)
See Also:
IndexOutOfBoundsException, Writer, Appendable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void close()
           throws IOException
See Also:
Writer, Closeable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[651]StringWriter example
By Anonymous on 2004/12/06 21:22:39  Rate
String output = null; 
 StringWriter writer = new StringWriter (  ) ; 
 PrintWriter out = new PrintWriter ( writer ) ; 
 out.println ( "Hello " ) ; 
 out.println ( "World!" ) ; 
  
  
 out.close (  ) ; 
 output = writer.toString (  ) ;


public void flush()
See Also:
Writer, Flushable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public StringBuffer getBuffer()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public StringWriter()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public StringWriter(int initialSize)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String toString()
See Also:
Object
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1610]Using StringWriter
By Anonymous on 2005/11/04 20:23:08  Rate
String source = ... //some contents of source xml file 
 String transform = .. //some contents for stylesheet XSLT file 
  
  
 Writer out = new StringWriter (  ) ; 
 TransformerFactory factory = TransformerFactory.newInstance (  ) ; 
 Transformer transformer = factory.newTransformer ( new StreamSource ( new StringReader ( transform )  )  ) ; 
 transformer.transform ( new StreamSource ( new StringReader ( source )  ) ,new StreamResult ( out )  ) ; 
 result = out.toString (  ) ; 
 


public void write(char[] cbuf,
                  int off,
                  int len)
See Also:
Writer
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void write(int c)
See Also:
Writer
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void write(String str)
See Also:
Writer
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void write(String str,
                  int off,
                  int len)
See Also:
Writer
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags