Package fr.gouv.vitam.common.stream

# Class StreamUtils

java.lang.Object
fr.gouv.vitam.common.stream.StreamUtils

public class StreamUtils extends Object
This class supports Helpers on streams.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static final long`
  `closeSilently(InputStream inputStream)`
  Close silently the InputStream, first consuming any bytes available, ignoring IOException or null object.
  `static void`
  `closeSilently(Channel channel)`
  `static void`
  `consumeAnyEntityAndClose(jakarta.ws.rs.core.Response response)`
  This method consume everything (in particular InpuStream) and close the response.
  `static boolean`
  `contentEquals(InputStream is1, InputStream is2)`
  `static final long`
  `copy(InputStream inputStream, OutputStream outputStream)`
  Copy InputStream to OutputStream efficiently
  InputStream will be closed, but not the OutputStream in order to be compatible with StreamingOutput
  `static final InputStream`
  `getRemainingReadOnCloseInputStream(InputStream inputStream)`
  Build an InputStream over the source one that will consume any left data when closing it.
  `static InputStream`
  `toInputStream(String source)`
  `static final String`
  `toString(InputStream inputStream)`

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

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

- ## Method Details

  - ### copy

    public static final long copy(InputStream inputStream, OutputStream outputStream) throws IOException
    Copy InputStream to OutputStream efficiently
    InputStream will be closed, but not the OutputStream in order to be compatible with StreamingOutput
    Parameters:
      `inputStream` -
      `outputStream` -
    Returns:
      the copied length
    Throws:
      `IOException`

  - ### closeSilently

    public static final long closeSilently(InputStream inputStream)
    Close silently the InputStream, first consuming any bytes available, ignoring IOException or null object.
    Parameters:
      `inputStream` -
    Returns:
      the length in bytes that were read before closing

  - ### getRemainingReadOnCloseInputStream

    public static final InputStream getRemainingReadOnCloseInputStream(InputStream inputStream)
    Build an InputStream over the source one that will consume any left data when closing it.
    Parameters:
      `inputStream` -
    Returns:
      the new InputStream to use

  - ### toString

    public static final String toString(InputStream inputStream) throws IOException
    Parameters:
      `inputStream` -
    Returns:
      the corresponding String from InputStream
    Throws:
      `IOException`

  - ### toInputStream

    public static InputStream toInputStream(String source)
    Parameters:
      `source` -
    Returns:
      the corresponding InputStream

  - ### contentEquals

    public static boolean contentEquals(InputStream is1, InputStream is2)
    Parameters:
      `is1` -
      `is2` -
    Returns:
      True if equals

  - ### consumeAnyEntityAndClose

    public static void consumeAnyEntityAndClose(jakarta.ws.rs.core.Response response)
    This method consume everything (in particular InpuStream) and close the response.
    Parameters:
      `response` -

  - ### closeSilently

    public static void closeSilently(Channel channel)