java.lang.Object
org.apache.groovy.json.internal.IO

public class IO extends Object
Reader and writer helpers used by the JSON parser internals.
  • Constructor Summary

    Constructors
    Constructor
    Description
    IO()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    copy(Reader input, Writer output)
    Copies all characters from a reader to a writer.
    static long
    copyLarge(Reader reader, Writer writer)
    Copies all characters from a reader to a writer using the default buffer size.
    static long
    copyLarge(Reader reader, Writer writer, char[] buffer)
    Copies all characters from a reader to a writer using the supplied buffer.
    static CharBuf
    read(Reader input, CharBuf charBuf, int bufSize)
    Reads all characters from a reader into a recyclable buffer and closes the reader.

    Methods inherited from class java.lang.Object

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

    • IO

      public IO()
  • Method Details

    • read

      public static CharBuf read(Reader input, CharBuf charBuf, int bufSize)
      Reads all characters from a reader into a recyclable buffer and closes the reader.
      Parameters:
      input - reader supplying characters
      charBuf - existing buffer to reuse, or null to allocate one
      bufSize - initial buffer size when a new buffer is allocated
      Returns:
      buffer containing the reader contents
    • copy

      public static int copy(Reader input, Writer output)
      Copies all characters from a reader to a writer.
      Parameters:
      input - reader supplying characters
      output - writer receiving characters
      Returns:
      number of copied characters, or -1 when the count exceeds Integer.MAX_VALUE
    • copyLarge

      public static long copyLarge(Reader reader, Writer writer)
      Copies all characters from a reader to a writer using the default buffer size.
      Parameters:
      reader - reader supplying characters
      writer - writer receiving characters
      Returns:
      number of copied characters
    • copyLarge

      public static long copyLarge(Reader reader, Writer writer, char[] buffer)
      Copies all characters from a reader to a writer using the supplied buffer.
      Parameters:
      reader - reader supplying characters
      writer - writer receiving characters
      buffer - temporary buffer to reuse during copying
      Returns:
      number of copied characters