Package net.sourceforge.uiq3
Class IO
- java.lang.Object
-
- net.sourceforge.uiq3.IO
-
public final class IO extends Object
- Since:
- 1.0
- Version:
- 1.0 $Revision: 8064 $
- Author:
- "Martin Krischik" «krischik@users.sourceforge.net»
-
-
Field Summary
Fields Modifier and Type Field Description private static int
Buffer_Size
private static Logger
Logger
Class logger instance.private static String
TAG
Class logger tag.
-
Constructor Summary
Constructors Modifier Constructor Description private
IO()
Do not create
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
copyStream(InputStream in, OutputStream out)
copy content of one stream into anotherstatic void
deleteAll(File dir)
delete all files in a directory.static String
Read_File(File File)
read file into stringstatic String
Read_File(String File_Name)
read file into stringstatic void
Un_Zip_Files(File Dest_Dir, File Source_File)
will extract all files from a zip into a directory.static void
writeToFile(@Nullable String data, File file)
convenience method, write string to filestatic void
writeToFile(InputStream data, File file)
convenience method, write string to filestatic void
Zip_Files(File Dest_File, File Source_Dir)
zips all files inside a directory.
-
-
-
Field Detail
-
Buffer_Size
private static final int Buffer_Size
- See Also:
- Constant Field Values
-
Logger
private static final Logger Logger
Class logger instance.
-
TAG
private static final String TAG
Class logger tag.
-
-
Method Detail
-
Read_File
public static String Read_File(File File) throws IOException
read file into string
- Parameters:
File
- the file to read- Returns:
- the string
- Throws:
IOException
-
Read_File
public static String Read_File(String File_Name) throws IOException
read file into string
- Parameters:
File_Name
- the filename- Returns:
- the string
- Throws:
IOException
-
Un_Zip_Files
public static void Un_Zip_Files(@NotNull File Dest_Dir, @NotNull File Source_File) throws IOException
will extract all files from a zip into a directory. This is the simple form without support for subdirectroies.
- Parameters:
Dest_Dir
- Directory to extract toSource_File
- zip file to extract from- Throws:
IOException
- unzip failed
-
Zip_Files
public static void Zip_Files(@NotNull File Dest_File, @NotNull File Source_Dir) throws IOException
zips all files inside a directory. Does not recourse into subdirectories. Will not zip the tip file if it is created inside the same directory
- Parameters:
Dest_File
- File to zip toSource_Dir
- Directory to zip files from- Throws:
IOException
- zip of files failed
-
copyStream
public static void copyStream(@NotNull InputStream in, @NotNull OutputStream out) throws IOException
copy content of one stream into another
- Parameters:
in
- stream to copy fromout
- stream to copy to- Throws:
IOException
- copy failed
-
deleteAll
public static void deleteAll(@NotNull File dir)
delete all files in a directory.
- Parameters:
dir
- directory to clean.
-
writeToFile
public static void writeToFile(@Nullable @Nullable String data, @Nullable File file) throws IOException
convenience method, write string to file
- Parameters:
data
- data to writefile
- file to write to- Throws:
IOException
-
writeToFile
public static void writeToFile(@Nullable InputStream data, @Nullable File file) throws IOException
convenience method, write string to file
- Parameters:
data
- data to writefile
- file to write to- Throws:
IOException
-
-