Class BufferingWriter

java.lang.Object
java.io.Writer
org.apache.jena.atlas.io.BufferingWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public final class BufferingWriter extends Writer
A buffering writer. Like BufferedWriter but with no synchronization. A "synchronized" per character can be expensive.

The standard java.io classes have hidden synchronization so in some very critical situations, this can be expensive.

This class is not thread safe.
  • Constructor Details

    • BufferingWriter

      public BufferingWriter(Writer dest)
      Create a buffering writer
    • BufferingWriter

      public BufferingWriter(Writer dest, int size)
      Create a buffering writer
    • BufferingWriter

      public BufferingWriter(Writer dest, int size, int blobSize)
      Create a buffering writer
  • Method Details

    • output

      public void output(String string)
      Output a string
      Parameters:
      string - Characters
    • output

      public void output(String string, int off, int length)
      Output a string
      Parameters:
      string - Characters
      off - Starting point in the string
      length - Length
    • output

      public void output(char[] chars)
      Output an array of characters
    • output

      public void output(char[] chars, int start, int length)
      Output an array of characters
      Parameters:
      chars - Characters
      start - Start
      length - Length
    • output

      public void output(char ch)
      Output a single character
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class Writer
    • flush

      public void flush()
      Specified by:
      flush in interface Flushable
      Specified by:
      flush in class Writer
    • write

      public void write(char[] cbuf, int off, int len) throws IOException
      Specified by:
      write in class Writer
      Throws:
      IOException
    • write

      public void write(char[] cbuf) throws IOException
      Overrides:
      write in class Writer
      Throws:
      IOException
    • write

      public void write(String string, int off, int len) throws IOException
      Overrides:
      write in class Writer
      Throws:
      IOException
    • write

      public void write(String string) throws IOException
      Overrides:
      write in class Writer
      Throws:
      IOException
    • write

      public void write(int ch) throws IOException
      Overrides:
      write in class Writer
      Throws:
      IOException