com.univocity.api.common
Class WriterProvider

java.lang.Object
  extended by com.univocity.api.common.WriterProvider
All Implemented Interfaces:
ResourceProvider<Writer>
Direct Known Subclasses:
StringWriterProvider

public abstract class WriterProvider
extends Object
implements ResourceProvider<Writer>

Base abstract class to define classes that provide instances of Writer.

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

Constructor Summary
WriterProvider()
           
 
Method Summary
abstract  void clearDestination()
          Removes any data contained in the resource being written using the instances of Writer provided by this class.
abstract  boolean isEmpty()
          Queries whether or not the resource to be written contains records already.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.univocity.api.common.ResourceProvider
getResource
 

Constructor Detail

WriterProvider

public WriterProvider()
Method Detail

clearDestination

public abstract void clearDestination()
Removes any data contained in the resource being written using the instances of Writer provided by this class.


isEmpty

public abstract boolean isEmpty()
Queries whether or not the resource to be written contains records already. This is used only for determining whether or not uniVocity should write a row with headers for each column in case the underlying resource is empty, and the entity is configured to write its headers to the output. Considering the entity is configured to write its headers to the output, the isEmpty() method will be queried and: If clearDestination() was invoked in the same transaction, uniVocity will know the entity is empty and will then attempt to write the header row. However, as it cannot determine whether the output has data already written in it; Mappings where clearDestination() is not used might produce outputs without the header row. This is likely to occur in write-only entities with no initial data.

Returns:
a flag indicating whether or not the underlying resource contains records.


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