public class Primitives extends Object
| Constructor and Description |
|---|
Primitives() |
| Modifier and Type | Method and Description |
|---|---|
static void |
copyFileUsingStream(File source,
File dest)
Extension of the stream method to copy file streams
|
static String |
createMissingFolder(String folderPathString)
Create a folder tree if one does not exist
|
static <T> T |
ifNull(T toCheck,
T ifNull)
Method to check if Object is null
|
static String |
inputStreamToString(InputStream stream)
Method to convert input stream to string
|
static <T> boolean |
isNull(T toCheck)
Method to check if Object is null
|
static com.adobe.aemfd.docmanager.Document |
readDoc(String path) |
static String |
readFile(String path,
Charset encoding)
Method used to read the contents of a file as string.
|
static long |
stream(InputStream input,
OutputStream output)
Writes an input stream into an output stream.
|
static String |
stripNewlineCharacters(String stripMe) |
static InputStream |
toInputStream(String string)
Method to convert a string into a ByteArrayInputStream
|
static void |
writeDoc(com.adobe.aemfd.docmanager.Document doc,
String path)
Method used to write document to disk by buffering input stream into a File
output stream.
|
public static InputStream toInputStream(String string) throws IOException
string - IOExceptionExceptionpublic static String inputStreamToString(InputStream stream) throws IOException
stream - IOExceptionpublic static void writeDoc(com.adobe.aemfd.docmanager.Document doc,
String path)
throws IOException
doc - path - IOExceptionpublic static com.adobe.aemfd.docmanager.Document readDoc(String path) throws FileNotFoundException, MalformedURLException
public static String readFile(String path, Charset encoding) throws IOException
path - encoding - IOExceptionpublic static <T> T ifNull(T toCheck,
T ifNull)
toCheck - ifNull - public static <T> boolean isNull(T toCheck)
toCheck - public static long stream(InputStream input, OutputStream output) throws IOException
input - output - IOExceptionhttp://stackoverflow.com/questions/10142409/write-an-inputstream-to-an-httpservletresponse}public static String createMissingFolder(String folderPathString)
folderPathString - public static void copyFileUsingStream(File source, File dest) throws IOException
source - dest - IOExceptionCopyright © 2021. All rights reserved.