Class AbstractSampleWriter

  • All Implemented Interfaces:
    java.io.Closeable , java.lang.AutoCloseable

    
    public abstract class AbstractSampleWriter
    extends SampleWriter
                        

    Base class for implementing sample writer.

    Handles buffering and output writer replacement.

    When a writer is set on the sample writer any previous writer is flushed and closed before being replaced by the new one.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      void setWriter(Writer newWriter) Set the new writer on which samples will be written by this sample writer.
      void setOutputStream(OutputStream out) Instructs this sample writer to write samples on the specified output with UTG-8 encoding.
      void setOutputFile(File output) Set the destination file in which this sample writer will write samples
      void close() This method is guaranteed to not throw any exception.
      • Methods inherited from class org.apache.jmeter.report.core.SampleWriter

        write
      • Methods inherited from class java.lang.Object

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

      • AbstractSampleWriter

        AbstractSampleWriter()
    • Method Detail

      • setWriter

         void setWriter(Writer newWriter)

        Set the new writer on which samples will be written by this sample writer. If any writer exists on the sample writer, it is flushed and closed before being replaced by the new one.

        Parameters:
        newWriter - The destination writer where samples will be written by this sample writer
      • setOutputStream

         void setOutputStream(OutputStream out)

        Instructs this sample writer to write samples on the specified output with UTG-8 encoding. The encoding can be overridden by the user through getFileEncoding

        Parameters:
        out - The output stream on which sample should be written
      • setOutputFile

         void setOutputFile(File output)

        Set the destination file in which this sample writer will write samples

        Parameters:
        output - The output file that will receive samples written by this sample writer
      • close

         void close()

        This method is guaranteed to not throw any exception. If writer is already closed then does nothing. Any buffered data is flushed by this method.