public class FileAssistant extends Object
Modifier and Type | Method and Description |
---|---|
static InputStream |
loadFile(File file)
Load a file resource via the
ClassLoader |
static InputStream |
loadFile(String fileName)
Load a file resource via the
ClassLoader |
static String |
readFile(String fileName)
Read a file resource via the
ClassLoader . |
static void |
writeStreamToFile(InputStream isr,
String fileName,
String outputFolder)
Write an
InputStream to a file |
public static InputStream loadFile(String fileName)
ClassLoader
fileName
- The name of the fileInputStream
that represents the stream of a file that was read from the file
system.public static InputStream loadFile(File file)
ClassLoader
file
- An object of type File
which represents a file objectInputStream
that represents the stream of a file that was read from the file
system.public static String readFile(String fileName) throws IOException
ClassLoader
. Return it as a String
.fileName
- The file name can either be an absolute path or a relative path from the project's base directory.IOException
public static void writeStreamToFile(InputStream isr, String fileName, String outputFolder) throws IOException
InputStream
to a fileisr
- the InputStream
fileName
- The target file name to use. Do not include the path.outputFolder
- The target folder to use.IOException
Copyright © 2016 PayPal Open Source. All rights reserved.