org.json.me
Class StringWriter

java.lang.Object
  extended by java.io.Writer
      extended by org.json.me.StringWriter

public class StringWriter
extends Writer

A simple StringBuffer-based implementation of StringWriter

Since:
BlackBerry API 6.0.0

Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
StringWriter()
           
StringWriter(int initialSize)
           
 
Method Summary
 void close()
          Close the stream, flushing it first.
 void flush()
          Flush the stream.
 String toString()
          Returns a string representation of the object.
 void write(char[] cbuf, int off, int len)
          Write a portion of an array of characters.
 void write(String str)
          Write a string.
 void write(String str, int off, int len)
          Write a portion of a string.
 
Methods inherited from class java.io.Writer
write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 



Constructor Detail

StringWriter

public StringWriter()
Since:
BlackBerry API 6.0.0

StringWriter

public StringWriter(int initialSize)
Since:
BlackBerry API 6.0.0


Method Detail

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws IOException
Description copied from class: Writer
Write a portion of an array of characters.

Specified by:
write in class Writer
Parameters:
cbuf - Array of characters
off - Offset from which to start writing characters
len - Number of characters to write
Throws:
IOException - If an I/O error occurs
Since:
BlackBerry API 6.0.0

write

public void write(String str)
           throws IOException
Description copied from class: Writer
Write a string.

Overrides:
write in class Writer
Parameters:
str - String to be written
Throws:
IOException - If an I/O error occurs
Since:
BlackBerry API 6.0.0

write

public void write(String str,
                  int off,
                  int len)
           throws IOException
Description copied from class: Writer
Write a portion of a string.

Overrides:
write in class Writer
Parameters:
str - A String
off - Offset from which to start writing characters
len - Number of characters to write
Throws:
IOException - If an I/O error occurs
Since:
BlackBerry API 6.0.0

flush

public void flush()
           throws IOException
Description copied from class: Writer
Flush the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.

Specified by:
flush in class Writer
Throws:
IOException - If an I/O error occurs
Since:
BlackBerry API 6.0.0

close

public void close()
           throws IOException
Description copied from class: Writer
Close the stream, flushing it first. Once a stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously-closed stream, however, has no effect.

Specified by:
close in class Writer
Throws:
IOException - If an I/O error occurs
Since:
BlackBerry API 6.0.0

toString

public String toString()
Description copied from class: Object
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString in class Object
Returns:
a string representation of the object.
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal