Package edu.umd.cs.findbugs.io
Class IO
java.lang.Object
edu.umd.cs.findbugs.io.IO
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Close given Closeable instance, ignoring any resulting exception.static void
close
(InputStream inputStream) Close given InputStream, ignoring any resulting exception.static void
close
(OutputStream outputStream) Close given OutputStream, ignoring any resulting exception.static void
Close given AutoCloseable instance, ignoring any resulting exception.static long
copy
(InputStream in, OutputStream out) static long
copy
(InputStream in, OutputStream out, long maxBytes) static long
static long
static URLConnection
When URL Connection uses cache, it may keep file handler.static InputStream
When URL Connection uses cache, it may keep file handler.static byte[]
readAll
(InputStream in) static byte[]
readAll
(InputStream in, int size) static String
static void
skipFully
(InputStream in, long bytes) Provide a skip fully method.static boolean
-
Constructor Details
-
IO
public IO()
-
-
Method Details
-
readAll
- Throws:
IOException
-
readAll
- Throws:
IOException
-
readAll
- Throws:
IOException
-
copy
public static long copy(@WillNotClose InputStream in, @WillNotClose OutputStream out) throws IOException - Throws:
IOException
-
copy
- Throws:
IOException
-
copy
public static long copy(@WillNotClose InputStream in, @WillNotClose OutputStream out, long maxBytes) throws IOException - Throws:
IOException
-
copy
- Throws:
IOException
-
close
Close given AutoCloseable instance, ignoring any resulting exception. -
close
Close given Closeable instance, ignoring any resulting exception. -
close
Close given InputStream, ignoring any resulting exception.- Parameters:
inputStream
- the InputStream to close; may be null (in which case nothing happens)
-
close
Close given OutputStream, ignoring any resulting exception.- Parameters:
outputStream
- the OutputStream to close; may be null (in which case nothing happens)
-
skipFully
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 skipbytes
- Number of bytes to skip- Throws:
EOFException
- if we reach EOF and still need to skip more bytesIOException
- if in.skip throws an IOException
-
verifyURL
-
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:
-