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 boolean
addLines(String uriString, Set<String> set)
static List<ClassLoader>
getClassLoaders()
Returns default classloaders.static InputStream
getInputStreamForClasspathFile(String path)
static InputStream
getInputStreamForClasspathFile(String path, ClassLoader loader)
static InputStream
getStreamForClasspathFile(String path, ClassLoader loader)
static InputStream
getStreamForUri(URI uri, ClassLoader loader)
static void
maybeCreateFileWithParentDirectories(File file)
static void
maybeDeleteFileOrThrow(File file)
static FileInputStream
prepareFileInputStream(File file)
static FileOutputStream
prepareFileOutputStream(File file)
static String
readFile(File file)
static String
readFileOrThrow(File file)
Reads the contents of a File.static boolean
writeFile(File file, CharSequence content)
static void
writeFileOrThrow(File file, CharSequence content)
-
-
-
Constructor Detail
-
FileUtils
public FileUtils()
-
-
Method Detail
-
getInputStreamForClasspathFile
public static InputStream getInputStreamForClasspathFile(String path)
-
getInputStreamForClasspathFile
public static InputStream getInputStreamForClasspathFile(String path, ClassLoader loader)
-
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:
MalformedURLException
IOException
-
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
-
-