Package org.jivesoftware.smack.util
Class FileUtils
- java.lang.Object
-
- org.jivesoftware.smack.util.FileUtils
-
-
Constructor Summary
Constructors Constructor Description FileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanaddLines(String uriString, Set<String> set)static List<ClassLoader>getClassLoaders()Returns default classloaders.static InputStreamgetStreamForClasspathFile(String path, ClassLoader loader)static InputStreamgetStreamForUri(URI uri, ClassLoader loader)static voidmaybeCreateFileWithParentDirectories(File file)static voidmaybeDeleteFileOrThrow(File file)static FileInputStreamprepareFileInputStream(File file)static FileOutputStreamprepareFileOutputStream(File file)static StringreadFile(File file)static StringreadFileOrThrow(File file)Reads the contents of a File.static booleanwriteFile(File file, CharSequence content)static voidwriteFileOrThrow(File file, CharSequence content)
-
-
-
Constructor Detail
-
FileUtils
public FileUtils()
-
-
Method Detail
-
getStreamForClasspathFile
public static InputStream getStreamForClasspathFile(String path, ClassLoader loader) throws IOException
- Throws:
IOException
-
getStreamForUri
public static InputStream getStreamForUri(URI uri, ClassLoader loader) throws IOException
- Throws:
IOException
-
getClassLoaders
public static List<ClassLoader> getClassLoaders()
Returns default classloaders.- Returns:
- a List of ClassLoader instances.
-
addLines
public static boolean addLines(String uriString, Set<String> set) throws MalformedURLException, IOException
- Throws:
MalformedURLExceptionIOException
-
readFileOrThrow
public static String readFileOrThrow(File file) throws 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:
IOException- if an I/O error occurred.
-
writeFileOrThrow
public static void writeFileOrThrow(File file, CharSequence content) throws IOException
- Throws:
IOException
-
writeFile
public static boolean writeFile(File file, CharSequence content)
-
prepareFileOutputStream
public static FileOutputStream prepareFileOutputStream(File file) throws IOException
- Throws:
IOException
-
prepareFileInputStream
public static FileInputStream prepareFileInputStream(File file) throws IOException
- Throws:
IOException
-
maybeDeleteFileOrThrow
public static void maybeDeleteFileOrThrow(File file) throws IOException
- Throws:
IOException
-
maybeCreateFileWithParentDirectories
public static void maybeCreateFileWithParentDirectories(File file) throws IOException
- Throws:
IOException
-
-