public class Tool4File
extends java.lang.Object
Tool4File
class provides functions for file processing.Modifier and Type | Field and Description |
---|---|
static int |
BATCH_LOG
constant value of batch log.
|
static int |
DATABASE_LOG
constant value of database log.
|
static int |
SYSTEM_LOG
constant value of system log.
|
Constructor and Description |
---|
Tool4File()
The constructor
Tool4File creates a new instance(object) of the class. |
Modifier and Type | Method and Description |
---|---|
java.io.File |
appendTheFile(java.lang.String full_path,
java.lang.String filename,
java.lang.String content)
The method
appendTheFile append the contend to the current file to file system. |
java.io.File |
appendTheFile(java.lang.String full_path,
java.lang.String filename,
java.lang.String content,
boolean new_line)
The method
appendTheFile append the contend to the current file to file system. |
void |
copyFile(java.io.File sourceFile,
java.io.File destFile)
The method
copyFile performs a copy with help from java
system. |
void |
copyFile(java.lang.String source_file_path,
java.lang.String dest_file_path)
The method
copyFile performs a file copy. |
java.lang.String |
createShortPath(java.lang.String curr_path)
The method
createShortPath creates a short path by hiding some chars in the middle. |
void |
deleteOldLogs()
The method
deleteOldLogs delete old log files. |
java.lang.String |
get_Path(MainDialog dialog,
java.lang.String curr_path,
boolean path_only,
java.lang.String[] extension)
The method
get_Path gets the path to a folder. |
java.io.File |
getConfigFile(java.lang.String filename)
The method
getConfigFile gets a config file. |
java.lang.String |
getContent(java.lang.String fileName)
The method
getContent read the file content from file system. |
java.util.ArrayList |
getFileContent(java.lang.String fileName)
The method
getFileContent loads the content of a file. |
java.util.ArrayList |
getFileContent(java.lang.String file_path,
java.lang.String fileName)
The method
getFileContent loads the content of a file. |
java.lang.String |
getFullPathToSystem(java.lang.String folder)
The method
getFullPathToSystem gets the full path to the current folder. |
java.io.File |
getTheFile(java.lang.String full_path)
The method
getTheFile gets the current file. |
java.io.File |
putTheFile(java.lang.String full_path,
java.lang.String filename,
byte[] contend)
The method
putTheFile puts the current file to file system. |
java.io.File |
putTheFile(java.lang.String full_path,
java.lang.String filename,
java.lang.String content)
The method
putTheFile puts the current file to file system. |
java.io.File |
putTheFile(java.lang.String full_path,
java.lang.String filename,
java.lang.String content,
boolean new_line)
The method
putTheFile puts the current file to file system. |
java.lang.String |
save_Path(MainDialog dialog,
java.lang.String curr_path,
boolean path_only,
java.lang.String[] extension)
The method
save_FITS_Path gets the path to a fits folder. |
void |
saveOldLog(int type,
java.lang.String systemlogname,
java.lang.String systemlognameext)
The method
saveOldLog copys the current log files into
directories. |
void |
writeLogoToFileSystem()
The method
writeLogoToFileSystem saves logo in main folder. |
public static final int SYSTEM_LOG
public static final int DATABASE_LOG
public static final int BATCH_LOG
public Tool4File()
Tool4File
creates a new instance(object) of the class.public void copyFile(java.lang.String source_file_path, java.lang.String dest_file_path) throws java.io.IOException
copyFile
performs a file copy.source_file_path
- the source file path.dest_file_path
- destination file path.java.io.IOException
- if errorpublic java.io.File getConfigFile(java.lang.String filename) throws java.lang.Exception
getConfigFile
gets a config file.filename
- name of the file to get.java.lang.Exception
- if errorpublic java.util.ArrayList getFileContent(java.lang.String fileName) throws java.lang.Exception
getFileContent
loads the content of a file.fileName
- the name of the current file.java.lang.Exception
- if errorpublic java.util.ArrayList getFileContent(java.lang.String file_path, java.lang.String fileName) throws java.lang.Exception
getFileContent
loads the content of a file.file_path
- the current path.fileName
- the name of the current file.java.lang.Exception
- if errorpublic java.lang.String getFullPathToSystem(java.lang.String folder) throws java.lang.Exception
getFullPathToSystem
gets the full path to the current folder.folder
- the folder of the file system.java.lang.Exception
- if errorpublic java.io.File getTheFile(java.lang.String full_path) throws java.lang.Exception
getTheFile
gets the current file.full_path
- of file (path + name).java.lang.Exception
- if errorpublic java.lang.String getContent(java.lang.String fileName) throws java.lang.Exception
getContent
read the file content from file system.fileName
- the name of the file.java.lang.Exception
- if errorpublic java.io.File appendTheFile(java.lang.String full_path, java.lang.String filename, java.lang.String content) throws java.lang.Exception
appendTheFile
append the contend to the current file to file system.full_path
- of file.filename
- the name of the current file.content
- the file content.java.lang.Exception
- if errorpublic java.io.File appendTheFile(java.lang.String full_path, java.lang.String filename, java.lang.String content, boolean new_line) throws java.lang.Exception
appendTheFile
append the contend to the current file to file system.full_path
- of file.filename
- the name of the current file.content
- the file content.new_line
- make a new line after writing.java.lang.Exception
- if errorpublic java.io.File putTheFile(java.lang.String full_path, java.lang.String filename, java.lang.String content) throws java.lang.Exception
putTheFile
puts the current file to file system.full_path
- of file.filename
- the name of the current file.content
- the file content.java.lang.Exception
- if errorpublic java.io.File putTheFile(java.lang.String full_path, java.lang.String filename, java.lang.String content, boolean new_line) throws java.lang.Exception
putTheFile
puts the current file to file system.full_path
- of file.filename
- the name of the current file.content
- the file content.new_line
- make a new line after writing.java.lang.Exception
- if errorpublic java.io.File putTheFile(java.lang.String full_path, java.lang.String filename, byte[] contend) throws java.lang.Exception
putTheFile
puts the current file to file system.full_path
- of file.filename
- the name of the current file.contend
- the file contend.java.lang.Exception
- if errorpublic void writeLogoToFileSystem() throws java.lang.Exception
writeLogoToFileSystem
saves logo in main folder.java.lang.Exception
- if error.java.lang.Exception
- if errorpublic java.lang.String get_Path(MainDialog dialog, java.lang.String curr_path, boolean path_only, java.lang.String[] extension) throws java.lang.Exception
get_Path
gets the path to a folder.dialog
- the calling frame.curr_path
- the current path.path_only
- get only the path without the file nameextension
- the extensionsjava.lang.Exception
- if error.public java.lang.String save_Path(MainDialog dialog, java.lang.String curr_path, boolean path_only, java.lang.String[] extension) throws java.lang.Exception
save_FITS_Path
gets the path to a fits folder.dialog
- the calling frame.curr_path
- the current path.path_only
- get only the path without the file nameextension
- the extensionsjava.lang.Exception
- if error.public java.lang.String createShortPath(java.lang.String curr_path) throws java.lang.Exception
createShortPath
creates a short path by hiding some chars in the middle.curr_path
- the current path.java.lang.Exception
- if error.public void saveOldLog(int type, java.lang.String systemlogname, java.lang.String systemlognameext) throws java.lang.Exception
saveOldLog
copys the current log files into
directories.type
- Tool4File.SYSTEM_LOG, Tool4File.DATABASE_LOG,
Tool4File.BATCH_LOG.systemlogname
- name of log file.systemlognameext
- extension of log file.java.lang.Exception
- if errorpublic void copyFile(java.io.File sourceFile, java.io.File destFile) throws java.io.IOException
copyFile
performs a copy with help from java
system.sourceFile
- the source file.destFile
- destination file.java.io.IOException
- if errorpublic void deleteOldLogs() throws java.lang.Exception
deleteOldLogs
delete old log files.java.lang.Exception
- if error