public class StringBufferWriter extends Writer
This class codes around a silly limitation of StringWriter which doesn't allow a StringBuffer to be passed in as a constructor for some bizarre reason. So we replicate the behaviour of StringWriter here but allow a StringBuffer to be passed in.
Constructor and description |
---|
StringBufferWriter(StringBuffer buffer) Create a new string writer which will append the text to the given StringBuffer |
Type Params | Return Type | Name and description |
---|---|---|
|
public void |
close() Closing a StringWriter has no effect. |
|
public void |
flush() Flush the stream. |
|
public String |
toString() Return the buffer's current value as a string. |
|
public void |
write(int c) Write a single character. |
|
public void |
write(char[] text, int offset, int length) Write a portion of an array of characters. |
|
public void |
write(String text) Write a string. |
|
public void |
write(String text, int offset, int length) Write a portion of a string. |
Create a new string writer which will append the text to the given StringBuffer
Closing a StringWriter has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.
Flush the stream.
Write a single character.
Write a portion of an array of characters.
text
- Array of charactersoffset
- Offset from which to start writing characterslength
- Number of characters to writeCopyright © 2003-2024 The Apache Software Foundation. All rights reserved.