Class StreamUtil

java.lang.Object
org.faktorips.util.StreamUtil

public class StreamUtil extends Object
A utility class for streams.
  • Method Details

    • copy

      public static final ByteArrayInputStream copy(InputStream is) throws IOException
      Copies the content of the provided InputStream into a ByteArrayInputStream and closes the provided stream.
      Parameters:
      is - the InputStream to be copied
      Returns:
      the new ByteArrayInputStream with the copied content
      Throws:
      IOException - exceptions that occur during reading from and writing to a stream or closing the provided stream are delegated
    • toByteArrayOutputStream

      public static final ByteArrayOutputStream toByteArrayOutputStream(InputStream is) throws IOException
      Copies the content of the provided InputStream into a ByteArrayOutputStream and closes the provided stream.
      Parameters:
      is - the InputStream to be copied
      Returns:
      the new ByteArrayInputStream with the copied content
      Throws:
      IOException - exceptions that occur during reading from and writing to a stream or closing the provided stream are delegated