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 intBuffer_Sizeprivate static LoggerLoggerClass logger instance.private static StringTAGClass logger tag.
-
Constructor Summary
Constructors Modifier Constructor Description privateIO()Do not create
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopyStream(InputStream in, OutputStream out)copy content of one stream into anotherstatic voiddeleteAll(File dir)delete all files in a directory.static StringRead_File(File File)read file into stringstatic StringRead_File(String File_Name)read file into stringstatic voidUn_Zip_Files(File Dest_Dir, File Source_File)will extract all files from a zip into a directory.static voidwriteToFile(@Nullable String data, File file)convenience method, write string to filestatic voidwriteToFile(InputStream data, File file)convenience method, write string to filestatic voidZip_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 IOExceptionwill 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 IOExceptionzips 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 IOExceptioncopy 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 IOExceptionconvenience 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 IOExceptionconvenience method, write string to file
- Parameters:
data- data to writefile- file to write to- Throws:
IOException
-
-