Top Description Fields Constructors Methods
org.testng.reporters

public Class FileStringBuffer

extends Object
implements IBuffer
Class Inheritance
All Implemented Interfaces
org.testng.reporters.IBuffer
Imports
java.io.BufferedWriter, .File, .FileReader, .FileWriter, .IOException, .Reader, .StringReader, .Writer, java.nio.file.Files, org.testng.log4testng.Logger

A string buffer that flushes its content to a temporary file whenever the internal string buffer becomes larger than MAX. If the buffer never reaches that size, no file is ever created and everything happens in memory, so the overhead compared to StringBuffer/StringBuilder is minimal.

Note

calling toString() will force the entire string to be loaded in memory, use toWriter() if you need to avoid this.

This class is not multi thread safe.

Since
Nov 9, 2012

Field Summary

Modifier and TypeField and Description
private static final Logger
private File
private final int
private StringBuilder
private static final int
private static final boolean

Constructor Summary

AccessConstructor and Description
public
public
FileStringBuffer(int maxCharacters)

Method Summary

Modifier and TypeMethod and Description
public FileStringBuffer
private static void
copy(Reader input, Writer output)

private void
private static void
p(String s)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER
m_fileback to summary
private File m_file
m_maxCharactersback to summary
private final int m_maxCharacters
m_sbback to summary
private StringBuilder m_sb
MAXback to summary
private static final int MAX
VERBOSEback to summary
private static final boolean VERBOSE

Constructor Detail

FileStringBufferback to summary
public FileStringBuffer()
FileStringBufferback to summary
public FileStringBuffer(int maxCharacters)

Method Detail

appendback to summary
public FileStringBuffer append(CharSequence s)

Implements org.testng.reporters.IBuffer.append.

Annotations
@Override
copyback to summary
private static void copy(Reader input, Writer output) throws IOException
flushToFileback to summary
private void flushToFile()
pback to summary
private static void p(String s)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
toWriterback to summary
public void toWriter(Writer fw)

Implements org.testng.reporters.IBuffer.toWriter.

Annotations
@Override