Class IO

java.lang.Object
edu.umd.cs.findbugs.io.IO

public class IO extends Object
  • Constructor Details

    • IO

      public IO()
  • Method Details

    • readAll

      public static byte[] readAll(@WillClose InputStream in) throws IOException
      Throws:
      IOException
    • readAll

      public static byte[] readAll(@WillClose InputStream in, int size) throws IOException
      Throws:
      IOException
    • readAll

      public static String readAll(Reader reader) throws IOException
      Throws:
      IOException
    • copy

      public static long copy(@WillNotClose InputStream in, @WillNotClose OutputStream out) throws IOException
      Throws:
      IOException
    • copy

      public static long copy(Reader in, Writer out) throws IOException
      Throws:
      IOException
    • copy

      public static long copy(@WillNotClose InputStream in, @WillNotClose OutputStream out, long maxBytes) throws IOException
      Throws:
      IOException
    • copy

      public static long copy(Reader in, Writer out, long maxChars) throws IOException
      Throws:
      IOException
    • close

      public static void close(@CheckForNull AutoCloseable c)
      Close given AutoCloseable instance, ignoring any resulting exception.
    • close

      public static void close(@CheckForNull Closeable c)
      Close given Closeable instance, ignoring any resulting exception.
    • close

      public static void close(@CheckForNull InputStream inputStream)
      Close given InputStream, ignoring any resulting exception.
      Parameters:
      inputStream - the InputStream to close; may be null (in which case nothing happens)
    • close

      public static void close(@CheckForNull OutputStream outputStream)
      Close given OutputStream, ignoring any resulting exception.
      Parameters:
      outputStream - the OutputStream to close; may be null (in which case nothing happens)
    • skipFully

      public static void skipFully(InputStream in, long bytes) throws IOException
      Provide a skip fully method. Either skips the requested number of bytes or throws an IOException;
      Parameters:
      in - The input stream on which to perform the skip
      bytes - Number of bytes to skip
      Throws:
      EOFException - if we reach EOF and still need to skip more bytes
      IOException - if in.skip throws an IOException
    • verifyURL

      public static boolean verifyURL(URL u)
    • openNonCachedConnection

      @CheckReturnValue @NonNull public static URLConnection openNonCachedConnection(@NonNull URL u) throws IOException
      When URL Connection uses cache, it may keep file handler. This method open connection without caching to avoid file handler leak.
      Returns:
      opened URLConnection which does not use cache to load data
      Throws:
      IOException
      See Also:
    • openNonCachedStream

      @CheckReturnValue @NonNull public static InputStream openNonCachedStream(@NonNull URL u) throws IOException
      When URL Connection uses cache, it may keep file handler. This method open connection without caching to avoid file handler leak.
      Returns:
      opened URLConnection which does not use cache to load data
      Throws:
      IOException
      See Also: