public class FileUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static InputStream |
getFileInputStream(Object object)
Attempts to convert the given
object to an InputStream. |
static String |
readFully(File file)
|
static String |
readFully(InputStream inputStream,
String encoding)
Reads the entire contents of the given
InputStream to a String. |
public static InputStream getFileInputStream(Object object) throws IOException
object to an InputStream. If the object cannot be converted, throws
an Exception.
Current supported object conversions include:
object - the object to convert to an input streamInputStream created from the given objectIOException - when the given Object cannot be converted to a FileInputStreampublic static String readFully(File file) throws IOException
file - the File to read the contents ofString that contains the contents of the given fileIOException - when the given File cannot be found or read frompublic static String readFully(InputStream inputStream, String encoding) throws IOException
InputStream to a String.inputStream - the InputStream to read the contents ofencoding - the character encoding that the resulting String should be (i.e. UTF-8)String that contains the contents of the given streamIOException - when the given InputStream cannot be read fromCopyright © 2017. All rights reserved.