public final class IO extends Object
Modifier and Type | Method and Description |
---|---|
static void |
closeQuietly(Closeable c)
Closes given object quietly.
|
static void |
copy(InputStream input,
OutputStream output) |
static String |
readFully(Reader reader)
Reads all characters from given reader and returns them as a string.
|
static byte[] |
toByteArray(InputStream inputStream) |
static File |
toFile(URL url)
Convert from an
URL to a File object. |
public static void closeQuietly(Closeable c)
c
- the object to close.public static String readFully(Reader reader) throws IOException
reader
- the reader to read, must not be null
.null
.IOException
public static File toFile(URL url)
URL
to a File
object. Performs decoding of the URL:
syntax such as file:///my%20docs/file.txt
will be
correctly decoded to /my docs/file.txt
.url
- the file URL to convert, null
returns null
File
object, or null
if the URL's protocol is not file
IllegalArgumentException
- if the file is incorrectly encodedpublic static byte[] toByteArray(InputStream inputStream) throws IOException
IOException
public static void copy(InputStream input, OutputStream output) throws IOException
IOException
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.