Package io.github.astrapi69.file
Class FileExtensions
- java.lang.Object
-
- io.github.astrapi69.file.FileExtensions
-
public final class FileExtensions extends java.lang.Object
Utility class for the use of File object.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
VELOCITY_TEMPLATE_FILE_EXTENSION
The Constant VELOCITY_TEMPLATE_FILE_EXTENSION.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static byte[]
download(java.net.URI uri)
Downloads Data from the given URI.static java.lang.String
getAbsolutPathWithoutFilename(java.io.File file)
Gets the absolut path without the filename.static java.lang.String
getContentType(java.io.File file)
Gets the content type from the given file objectstatic java.lang.String
getCurrentAbsolutPathWithoutDotAndSlash()
Gets the current absolut path without the dot and slash.static java.lang.String
getFilenamePrefix(java.io.File file)
Deprecated.use instead the same name method in classFilenameExtensions
from module silly-io.static java.lang.String
getFilenameSuffix(java.io.File file)
Deprecated.use instead the same name method in classFilenameExtensions
from module silly-io.static java.lang.String
getFilenameWithoutExtension(java.io.File file)
Deprecated.use instead the same name method in classFilenameExtensions
from module silly-io.static boolean
isOpen(java.io.File file)
Not yet implemented.
-
-
-
Field Detail
-
VELOCITY_TEMPLATE_FILE_EXTENSION
public static final java.lang.String VELOCITY_TEMPLATE_FILE_EXTENSION
The Constant VELOCITY_TEMPLATE_FILE_EXTENSION.- See Also:
- Constant Field Values
-
-
Method Detail
-
download
public static byte[] download(java.net.URI uri) throws java.io.IOException
Downloads Data from the given URI.- Parameters:
uri
- The URI from where to download.- Returns:
- Returns a byte array or null.
- Throws:
java.io.IOException
- Signals that an I/O exception has occurred.
-
getAbsolutPathWithoutFilename
public static java.lang.String getAbsolutPathWithoutFilename(java.io.File file)
Gets the absolut path without the filename.- Parameters:
file
- the file.- Returns:
- 's the absolut path without filename.
-
getCurrentAbsolutPathWithoutDotAndSlash
public static java.lang.String getCurrentAbsolutPathWithoutDotAndSlash()
Gets the current absolut path without the dot and slash.- Returns:
- 's the current absolut path without the dot and slash.
-
getFilenamePrefix
public static java.lang.String getFilenamePrefix(java.io.File file)
Deprecated.use instead the same name method in classFilenameExtensions
from module silly-io. Note that this method will be deleted in next major releaseGets the filename with the absolute path prefix.- Parameters:
file
- the file.- Returns:
- the filename prefix
-
getFilenameSuffix
public static java.lang.String getFilenameSuffix(java.io.File file)
Deprecated.use instead the same name method in classFilenameExtensions
from module silly-io. Note that this method will be deleted in next major releaseGets the filename suffix or null if no suffix exists or the given file object is a directory.- Parameters:
file
- the file.- Returns:
- 's the filename suffix or null if no suffix exists or the given file object is a directory.
-
getContentType
public static java.lang.String getContentType(java.io.File file) throws java.io.IOException
Gets the content type from the given file object- Parameters:
file
- the file- Returns:
- 's the content type from the given file object
- Throws:
java.io.IOException
- Signals that an I/O exception has occurred
-
getFilenameWithoutExtension
public static java.lang.String getFilenameWithoutExtension(java.io.File file)
Deprecated.use instead the same name method in classFilenameExtensions
from module silly-io. Note that this method will be deleted in next major releaseGets the filename without the extension or null if the given file object is a directory.- Parameters:
file
- the file.- Returns:
- the filename without the extension or null if the given file object is a directory
-
isOpen
public static boolean isOpen(java.io.File file) throws java.io.IOException
Not yet implemented. Checks if the given file is open.- Parameters:
file
- The file to check.- Returns:
- Return true if the file is open otherwise false.
- Throws:
java.io.IOException
- Signals that an I/O exception has occurred.
-
-