com.univocity.api.io
Class StringWriterProvider

java.lang.Object
  extended by com.univocity.api.io.WriterProvider
      extended by com.univocity.api.io.StringWriterProvider
All Implemented Interfaces:
ResourceProvider<Writer>

public final class StringWriterProvider
extends WriterProvider

A WriterProvider for Strings. Use this to write data directly to a String. This is just a convenience class that you can use to write test cases without having to deal with files or other persistent resources.

Author:
uniVocity Software Pty Ltd - dev@univocity.com
See Also:
WriterProvider

Constructor Summary
StringWriterProvider()
          Creates a new, empty StringWriterProvider
 
Method Summary
 void clearDestination()
          Clears the contents written to the string so far
 StringWriter getResource()
          Obtains a new StringWriter instance.
 String getString()
          Returns the contents written to the string so far.
 boolean isEmpty()
          Queries whether or not the resource to be written contains any sort of content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringWriterProvider

public StringWriterProvider()
Creates a new, empty StringWriterProvider

Method Detail

getResource

public final StringWriter getResource()
Obtains a new StringWriter instance.

Returns:
a new StringWriter

clearDestination

public final void clearDestination()
Clears the contents written to the string so far

Specified by:
clearDestination in class WriterProvider

getString

public final String getString()
Returns the contents written to the string so far.

Returns:
the contents written to the string so far.

isEmpty

public final boolean isEmpty()
Description copied from class: WriterProvider
Queries whether or not the resource to be written contains any sort of content.

Specified by:
isEmpty in class WriterProvider
Returns:
a flag indicating whether or not the underlying resource contains data.


Copyright © 2018 uniVocity Software Pty Ltd. All rights reserved.