Class IO
java.lang.Object
edu.umd.cs.findbugs.io.IO
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static ThreadLocal<byte[]> (package private) static ThreadLocal<char[]> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClose given Closeable instance, ignoring any resulting exception.static voidclose(InputStream inputStream) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated and will be removed in or after October 2026.static voidclose(OutputStream outputStream) Close given OutputStream, ignoring any resulting exception.static voidClose given AutoCloseable instance, ignoring any resulting exception.static longcopy(InputStream in, OutputStream out) static longcopy(InputStream in, OutputStream out, long maxBytes) static longstatic long(package private) static byte[]copyOf(byte[] original, int newLength) static URLConnectionWhen URL Connection uses cache, it may keep file handler.static InputStreamWhen URL Connection uses cache, it may keep file handler.static byte[]readAll(InputStream in) static byte[]readAll(InputStream in, int size) static Stringstatic voidskipFully(InputStream in, long bytes) Provide a skip fully method.static boolean
-
Field Details
-
myByteBuf
-
myCharBuf
-
-
Constructor Details
-
IO
public IO()
-
-
Method Details
-
readAll
- Throws:
IOException
-
copyOf
static byte[] copyOf(byte[] original, int newLength) -
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
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated and will be removed in or after October 2026. Use try-with resources when creating the stream instead.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
URLConnectionwhich 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
URLConnectionwhich does not use cache to load data - Throws:
IOException- See Also:
-