Class StringRecordWriter<P>

  • Type Parameters:
    P - type of the record's payload
    All Implemented Interfaces:
    RecordWriter<P>

    public class StringRecordWriter<P>
    extends java.lang.Object
    implements RecordWriter<P>
    Writes the payload of record to a StringWriter by calling its toString method.
    Author:
    Mahmoud Ben Hassine ([email protected])
    • Constructor Summary

      Constructors 
      Constructor Description
      StringRecordWriter​(java.io.StringWriter stringWriter)
      Create a new StringWriter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the writer
      void writeRecords​(Batch<P> batch)
      Write a batch of records to a data sink.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringRecordWriter

        public StringRecordWriter​(java.io.StringWriter stringWriter)
        Create a new StringWriter.
        Parameters:
        stringWriter - to write strings to
    • Method Detail

      • writeRecords

        public void writeRecords​(Batch<P> batch)
        Description copied from interface: RecordWriter
        Write a batch of records to a data sink.
        Specified by:
        writeRecords in interface RecordWriter<P>
        Parameters:
        batch - of records to write.
      • close

        public void close()
                   throws java.lang.Exception
        Description copied from interface: RecordWriter
        Close the writer
        Specified by:
        close in interface RecordWriter<P>
        Throws:
        java.lang.Exception - if an error occurs during closing the writer