Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.any23.util
Class StreamUtils

    java.lang.Object
      org.apache.any23.util.StreamUtils

    public class StreamUtils

extends Object

Contains general utility functions for handling streams.

Author:
  Michele Mostarda (mostarda@fbk.eu)

Method Summary
`static String[]` | `asLines(InputStream is)` Returns all the lines read from an input stream.
`static String` | `asString(InputStream is)` Returns the string content of a stream, new line chars will be removed.
`static String` | `asString(InputStream is, boolean preserveNL)` Returns the string content of a stream.
`static void` | `closeGracefully(Closeable closable)` Closes the closable interface and reports error if any.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### asLines

    public static String[] asLines(InputStream is)
                            throws IOException

  Returns all the lines read from an input stream.

  Parameters:
    `is` - input stream.
  Returns:
    list of not `null` lines.
  Throws:
    `IOException`

### asString

    public static String asString(InputStream is,
                                  boolean preserveNL)
                           throws IOException

  Returns the string content of a stream.

  Parameters:
    `is` - input stream.
    `preserveNL` - preserves new line chars.
  Returns:
    the string content.
  Throws:
    `IOException` - if an error occurs while consuming the `is` stream.

### asString

    public static String asString(InputStream is)
                           throws IOException

  Returns the string content of a stream, new line chars will be removed.

  Parameters:
    `is` - input stream.
  Returns:
    the string content.
  Throws:
    `IOException` - if an error occurs while consuming the `is` stream.

### closeGracefully

    public static void closeGracefully(Closeable closable)

  Closes the closable interface and reports error if any.

  Parameters:
    `closable` - the closable object to be closed.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.