Klasse SimpleJavaUtils
java.lang.Object
ch.framedev.simplejavautils.SimpleJavaUtils
-
Feldübersicht
Felder -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidcopyFileTo(File source, File target) Copy a File to a new LocationcreateEmptyLogger(String name, boolean timeFormat) This Method Creates a Logger from scratchcreateLogger(String name) voidDebug an ObjectdecodeFileFromBase64Binary(byte[] decodedFile, String extension, String fileName, String location) decodeFileFromBase64BinaryTmp(byte[] decodedFile, String extension) voidDownload a File from an UrlvoidDownload a File from an Url and copying it to a new Folderbyte[]voidPrint an Error with the Object (System.err.println())booleanexistsFile(File file) Check if the selected File is existingbooleanexistsFile(String fileName) Check if a File is existingRetrieves the file path of the application based on the operating system.getFilePath(Class<?> clazz) Retrieves the file path of the application based on the operating system.getFromResourceFile(String file) getFromResourceFile(String file, Class<?> class_) <T> TgetObjectFromBase64File(File file) Return an Object as (T) from a FilegetOs()Return the Operating System NameReturn Os's VersionGet The Temp DirectoryGet the user Applications Store FolderGet the User's DirectoryGet The User Home DirectorybooleanCheck if Server with Port is Online or can Connect Timeout default is 2500 Millisecondsstatic booleanCheck if Server with Port is Online or can connectvoidmoveFileTo(File source, File target) Move a File to the new Location<T> TobjectFromBase64(String base) Decode a Base64 String<T extends Serializable>
StringobjectToBase64(T object) Create a String of a Base64 (encode)doubleround(double value, int places) Round a double value to the giving Places<T extends Serializable>
voidsaveObjectToBase64File(File file, T object) Save an object to a Base64 Fileprotected FileString[]stringSplitter(String text, @NotNull String regex) zipDirectory(File directory, File outPut) Zipping a Complete DirectoryCreate a Zip Archive where the Files contains
-
Felddetails
-
logger
-
-
Konstruktordetails
-
SimpleJavaUtils
public SimpleJavaUtils()
-
-
Methodendetails
-
objectToBase64
Create a String of a Base64 (encode)- Parameter:
object- the Object to encode to Base64- Gibt zurück:
- returns the encoded Base64 Byte Array
-
objectFromBase64
Decode a Base64 String- Parameter:
base- the encoded Base64- Gibt zurück:
- returns the decoded Object
-
saveObjectToBase64File
Save an object to a Base64 File- Typparameter:
T- need to extend Serializable- Parameter:
file- the selected File for Saveobject- the Object to Save
-
getObjectFromBase64File
Return an Object as (T) from a File- Typparameter:
T- the Object- Parameter:
file- the Selected File where the Base64 File is stored- Gibt zurück:
- return an Object from a Base64 String File
-
debug
-
error
Print an Error with the Object (System.err.println())- Parameter:
object- the selected Object for printing an error
-
createLogger
-
stringSplitter
-
createEmptyLogger
-
round
public double round(double value, int places) Round a double value to the giving Places- Parameter:
value- The Value to Roundplaces- the Places where the Comma will bee- Gibt zurück:
- return the Rounded Value of the giving Value to the Places
-
download
public void download(String fileUrl, String location, String fileNameWithExtensions, String newLocation) Download a File from an Url and copying it to a new Folder- Parameter:
fileUrl- the Download Urllocation- the Location where the Downloaded file will be addedfileNameWithExtensions- the FileName with the extensionnewLocation- the new Location where the File will be
-
download
-
getTempDir
-
getUserHome
-
getUserDir
-
getUserAppData
Get the user Applications Store Folder- Gibt zurück:
- return the Applications Store Folder
-
getOs
-
getOsVersion
-
streamToFile
- Parameter:
in- InputStream- Gibt zurück:
- the File from the InputStream
-
getFromResourceFile
-
getFromResourceFile
-
existsFile
Check if a File is existing- Parameter:
fileName- the FileName to check if it is existing or not- Gibt zurück:
- return a boolean if exists or not
-
existsFile
Check if the selected File is existing- Parameter:
file- the Selected File- Gibt zurück:
- return if exists or not
-
copyFileTo
Copy a File to a new Location- Parameter:
source- the Selected File to Copytarget- the Selected File where the File will be copied- Löst aus:
IOException- throw an IOException if an error occurred
-
moveFileTo
Move a File to the new Location- Parameter:
source- the File to Movetarget- the File where the File will be moved- Löst aus:
IOException- throw an IOException if an error occurred
-
zipDirectory
Zipping a Complete Directory- Parameter:
directory- the Selected Directory for zipping- Gibt zurück:
- return the Zipped Directory as .zip
- Löst aus:
IOException- throw an IOException if an Error occurred
-
zipFiles
Create a Zip Archive where the Files contains- Parameter:
zipFile- the Zip file where all Files containsfiles- the Selected Files for Zipping- Gibt zurück:
- return the Zipped File
- Löst aus:
IOException- throw when unsuccessful
-
isOnline
Check if Server with Port is Online or can connect- Parameter:
server- Server Ip or HostNameport- port as example for MySQL 3306timeout- how long is it trying to connect- Gibt zurück:
- return if is Online or not
-
isOnline
Check if Server with Port is Online or can Connect Timeout default is 2500 Milliseconds- Parameter:
server- Server Ip or HostNameport- port as example for MySQL 3306- Gibt zurück:
- return if is Online or not
-
getLogger
-
getFilePath
Retrieves the file path of the application based on the operating system. If the operating system is Windows, the method returns the file path with a backslash as the separator. For other operating systems, the method returns the file path with a forward slash as the separator. If an error occurs while getting the file path, a runtime exception is thrown with the original exception as the cause.- Gibt zurück:
- the file path of the application
-
getFilePath
Retrieves the file path of the application based on the operating system. If the operating system is Windows, the method returns the file path with a backslash as the separator. For other operating systems, the method returns the file path with a forward slash as the separator. If an error occurs while getting the file path, a runtime exception is thrown with the original exception as the cause.- Gibt zurück:
- the file path of the application
-
encodeFileToBase64BinaryArray
-
decodeFileFromBase64Binary
-
decodeFileFromBase64BinaryTmp
-