IOTools (Apache Tomcat 7.0.104 API Documentation)

org.apache.catalina.util

## Class IOTools

- java.lang.Object
- - org.apache.catalina.util.IOTools

-     public class IOTools
      extends Object

  Contains commonly needed I/O-related methods
  Author:
    Dan Sandberg

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static int` | `DEFAULT_BUFFER_SIZE`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `flow(InputStream is, OutputStream os)`
    `static void` | `flow(InputStream is, OutputStream os, byte[] buf)` Read input from input stream and write it to output stream until there is no more input from input stream.
    `static void` | `flow(Reader reader, Writer writer)`
    `static void` | `flow(Reader reader, Writer writer, char[] buf)` Read input from reader and write it to writer until there is no more input from reader.
    `static int` | `readFully(InputStream is, byte[] buf)` Read until EOF or the buffer is filled.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_BUFFER_SIZE

          protected static final int DEFAULT_BUFFER_SIZE

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### flow

          public static void flow(Reader reader,
                  Writer writer,
                  char[] buf)
                           throws IOException

      Read input from reader and write it to writer until there is no more input from reader.
      Parameters:
        `reader` - the reader to read from.
        `writer` - the writer to write to.
        `buf` - the char array to use as a buffer
      Throws:
        `IOException`

    - #### flow

          public static void flow(Reader reader,
                  Writer writer)
                           throws IOException

      Throws:
        `IOException`
      See Also:
        `flow( Reader, Writer, char[] )`

    - #### flow

          public static void flow(InputStream is,
                  OutputStream os,
                  byte[] buf)
                           throws IOException

      Read input from input stream and write it to output stream until there is no more input from input stream.
      Parameters:
        `is` - input stream the input stream to read from.
        `os` - output stream the output stream to write to.
        `buf` - the byte array to use as a buffer
      Throws:
        `IOException`

    - #### flow

          public static void flow(InputStream is,
                  OutputStream os)
                           throws IOException

      Throws:
        `IOException`
      See Also:
        `flow( java.io.InputStream, java.io.OutputStream, byte[] )`

    - #### readFully

          public static int readFully(InputStream is,
                      byte[] buf)
                               throws IOException

      Read until EOF or the buffer is filled.
      Parameters:
        `is` - The source to read from
        `buf` - The buffer to write to
      Returns:
        The number of bytes read
      Throws:
        `IOException` - If an I/O error occurs during the read

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.