public final class IO
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
closeQuietly(java.io.Closeable c)
Closes given object quietly.
|
static void |
copy(java.io.InputStream input,
java.io.OutputStream output) |
static java.lang.String |
readFully(java.io.Reader reader)
Reads all characters from given reader and returns them as a string.
|
static byte[] |
toByteArray(java.io.InputStream inputStream) |
static java.io.File |
toFile(java.net.URL url)
Convert from an
URL to a File object. |
public static void closeQuietly(java.io.Closeable c)
c
- the object to close.public static java.lang.String readFully(java.io.Reader reader) throws java.io.IOException
reader
- the reader to read, must not be null
.null
.java.io.IOException
public static java.io.File toFile(java.net.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
java.lang.IllegalArgumentException
- if the file is incorrectly encodedpublic static byte[] toByteArray(java.io.InputStream inputStream) throws java.io.IOException
java.io.IOException
public static void copy(java.io.InputStream input, java.io.OutputStream output) throws java.io.IOException
java.io.IOException
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.