Package org.jivesoftware.smack.util
Class FileUtils
- java.lang.Object
-
- org.jivesoftware.smack.util.FileUtils
-
public final class FileUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description FileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
addLines(java.lang.String uriString, java.util.Set<java.lang.String> set)
static java.util.List<java.lang.ClassLoader>
getClassLoaders()
Returns default classloaders.static java.io.InputStream
getInputStreamForClasspathFile(java.lang.String path)
static java.io.InputStream
getInputStreamForClasspathFile(java.lang.String path, java.lang.ClassLoader loader)
static java.io.InputStream
getStreamForClasspathFile(java.lang.String path, java.lang.ClassLoader loader)
static java.io.InputStream
getStreamForUri(java.net.URI uri, java.lang.ClassLoader loader)
static void
maybeCreateFileWithParentDirectories(java.io.File file)
static void
maybeDeleteFileOrThrow(java.io.File file)
static java.io.FileInputStream
prepareFileInputStream(java.io.File file)
static java.io.FileOutputStream
prepareFileOutputStream(java.io.File file)
static java.lang.String
readFile(java.io.File file)
static java.lang.String
readFileOrThrow(java.io.File file)
Reads the contents of a File.static boolean
writeFile(java.io.File file, java.lang.CharSequence content)
static void
writeFileOrThrow(java.io.File file, java.lang.CharSequence content)
-
-
-
Constructor Detail
-
FileUtils
public FileUtils()
-
-
Method Detail
-
getInputStreamForClasspathFile
public static java.io.InputStream getInputStreamForClasspathFile(java.lang.String path)
-
getInputStreamForClasspathFile
public static java.io.InputStream getInputStreamForClasspathFile(java.lang.String path, java.lang.ClassLoader loader)
-
getStreamForClasspathFile
public static java.io.InputStream getStreamForClasspathFile(java.lang.String path, java.lang.ClassLoader loader) throws java.io.IOException
- Throws:
java.io.IOException
-
getStreamForUri
public static java.io.InputStream getStreamForUri(java.net.URI uri, java.lang.ClassLoader loader) throws java.io.IOException
- Throws:
java.io.IOException
-
getClassLoaders
public static java.util.List<java.lang.ClassLoader> getClassLoaders()
Returns default classloaders.- Returns:
- a List of ClassLoader instances.
-
addLines
public static boolean addLines(java.lang.String uriString, java.util.Set<java.lang.String> set) throws java.net.MalformedURLException, java.io.IOException
- Throws:
java.net.MalformedURLException
java.io.IOException
-
readFileOrThrow
public static java.lang.String readFileOrThrow(java.io.File file) throws java.io.IOException
Reads the contents of a File.- Parameters:
file
- TODO javadoc me please- Returns:
- the content of file or null in case of an error
- Throws:
java.io.IOException
- if an I/O error occurred.
-
readFile
public static java.lang.String readFile(java.io.File file)
-
writeFileOrThrow
public static void writeFileOrThrow(java.io.File file, java.lang.CharSequence content) throws java.io.IOException
- Throws:
java.io.IOException
-
writeFile
public static boolean writeFile(java.io.File file, java.lang.CharSequence content)
-
prepareFileOutputStream
public static java.io.FileOutputStream prepareFileOutputStream(java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
prepareFileInputStream
public static java.io.FileInputStream prepareFileInputStream(java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
maybeDeleteFileOrThrow
public static void maybeDeleteFileOrThrow(java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
maybeCreateFileWithParentDirectories
public static void maybeCreateFileWithParentDirectories(java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
-