Class IOUtils

java.lang.Object
org.apache.commons.csv.IOUtils

final class IOUtils extends Object
Copied from Apache Commons IO.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final int
    The default buffer size (4096).
    private static final int
    Represents the end-of-file (or stream).
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    No instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static long
    copy(Reader input, Appendable output)
    Copies chars from a large (over 2GB) Reader to an Appendable.
    (package private) static long
    copy(Reader input, Appendable output, CharBuffer buffer)
    Copies chars from a large (over 2GB) Reader to an Appendable.
    (package private) static long
    copyLarge(Reader input, Writer output)
    Copies chars from a large (over 2GB) Reader to a Writer.
    (package private) static long
    copyLarge(Reader input, Writer output, char[] buffer)
    Copies chars from a large (over 2GB) Reader to a Writer.
    (package private) static <T extends Throwable>
    RuntimeException
    rethrow(Throwable throwable)
    Throws the given throwable.

    Methods inherited from class java.lang.Object

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

    • DEFAULT_BUFFER_SIZE

      static final int DEFAULT_BUFFER_SIZE
      The default buffer size (4096).
      See Also:
    • EOF

      private static final int EOF
      Represents the end-of-file (or stream).
      See Also:
  • Constructor Details

    • IOUtils

      private IOUtils()
      No instances.
  • Method Details

    • copy

      static long copy(Reader input, Appendable output) throws IOException
      Copies chars from a large (over 2GB) Reader to an Appendable.

      This method buffers the input internally, so there is no need to use a BufferedReader.

      The buffer size is given by DEFAULT_BUFFER_SIZE.
      Parameters:
      input - the Reader to read from
      output - the Appendable to append to
      Returns:
      the number of characters copied
      Throws:
      NullPointerException - if the input or output is null
      IOException - if an I/O error occurs
      Since:
      2.7
    • copy

      static long copy(Reader input, Appendable output, CharBuffer buffer) throws IOException
      Copies chars from a large (over 2GB) Reader to an Appendable.

      This method uses the provided buffer, so there is no need to use a BufferedReader.

      Parameters:
      input - the Reader to read from
      output - the Appendable to write to
      buffer - the buffer to be used for the copy
      Returns:
      the number of characters copied
      Throws:
      NullPointerException - if the input or output is null
      IOException - if an I/O error occurs
      Since:
      2.7
    • copyLarge

      static long copyLarge(Reader input, Writer output) throws IOException
      Copies chars from a large (over 2GB) Reader to a Writer.

      This method buffers the input internally, so there is no need to use a BufferedReader.

      The buffer size is given by DEFAULT_BUFFER_SIZE.

      Parameters:
      input - the Reader to read from
      output - the Writer to write to
      Returns:
      the number of characters copied
      Throws:
      NullPointerException - if the input or output is null
      IOException - if an I/O error occurs
      Since:
      1.3
    • copyLarge

      static long copyLarge(Reader input, Writer output, char[] buffer) throws IOException
      Copies chars from a large (over 2GB) Reader to a Writer.

      This method uses the provided buffer, so there is no need to use a BufferedReader.

      Parameters:
      input - the Reader to read from
      output - the Writer to write to
      buffer - the buffer to be used for the copy
      Returns:
      the number of characters copied
      Throws:
      NullPointerException - if the input or output is null
      IOException - if an I/O error occurs
      Since:
      2.2
    • rethrow

      static <T extends Throwable> RuntimeException rethrow(Throwable throwable) throws T
      Throws the given throwable.
      Type Parameters:
      T - The throwable cast type.
      Parameters:
      throwable - The throwable to rethrow.
      Returns:
      nothing because we throw.
      Throws:
      T - Always thrown.