Package org.javlo.helper
Class ResourceHelper
- java.lang.Object
-
- org.javlo.helper.ResourceHelper
-
public class ResourceHelper extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ResourceHelper.ImageFilenameFilter
static class
ResourceHelper.VideoFilenameFilter
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_BUFFER_SIZE
protected static Logger
logger
create a static logger.static String
PRIVATE_DIR
file in private dir could not be downloadedstatic Object
SYNCHRO_RESOURCE
-
Constructor Summary
Constructors Constructor Description ResourceHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
appendStringToFile(File file, String line)
static boolean
canModifFolder(ContentContext ctx, String folder)
static String
changeExtention(String filename, String newext)
static boolean
checksumEquals(String checksum1, String checksum2)
static boolean
cleanAllFileName(File file)
normalize all file name from a dirstatic List<String>
cleanFolderList(Collection<String> folders)
clear a folder list, remove '/' if found as first char and replace '\' by '/'static int
cleanImportResource(ContentContext ctx, File childImport)
static int
cleanImportResources(ContentContext ctx)
delete import without reference to a existing page.static void
closeResource(Closeable... resources)
static void
closeResource(HttpURLConnection... connections)
static String
computeChecksum(File file)
Return the standard checksum of the specified file.static void
copyDir(File dir1, File dir2, boolean overwrite, FileFilter filter)
static boolean
copyFile(File source, File destination, boolean overwrite)
transactional copy a file other filestatic void
copyResourceData(ContentContext ctx, File file, File newFile)
duplicate static info of a resource to a new filestatic void
copyStream(InputStream input, OutputStream output, long start, long length)
Copy the given byte range of the given input to the given output.static int
countLines(File file)
static String
createModulePath(ContentContext ctx, String path)
static boolean
deleteFileAndParentDir(File file)
static boolean
deleteFolder(File folder)
static boolean
deleteResource(ContentContext ctx, File file)
static void
deleteResourceData(ContentContext ctx, File file)
static void
docx2html(File docx, File html)
static void
downloadResource(ContentContext ctx, String localDir, String baseURL, NodeXML nodeXML)
static String
downloadResourceAsString(URL workURL)
static String
excutePost(String targetURL, String urlParameters)
static String
excutePost(String targetURL, String urlParameters, String contentType, String lang, String user, String pwd)
static String
extractNotStaticDir(StaticConfig staticConfig, GlobalContext globalContext, String fullPath)
extract a relative path from a full path.static String
extractResourceDir(StaticConfig staticConfig, GlobalContext globalContext, String fullPath)
extract a relative path from a full path.static String
extractResourcePathFromURL(ContentContext ctx, String url)
static String
extractTemplateName(GlobalContext globalContext, File file)
return the name of the templatestatic String
fileStructureToHtml(File file)
static void
filteredFileCopy(File file1, File file2, Map<String,String> filter)
static void
filteredFileCopyEscapeScriplet(File file1, File file2, Map<String,String> filter, boolean compress, boolean secure)
static List<File>
getAllDirList(File dir)
get all directories under a directory (recursivly).static Collection<File>
getAllFiles(File dir, FileFilter filter)
static Collection<File>
getAllFiles(File dir, FileFilter filter, Comparator<File> comp)
static Collection<File>
getAllFilesList(File dir)
get all files under a directory (recursivly).static Collection<File>
getAllResources(ContentContext ctx)
static InputStream
getChecksumInputStream(InputStream in)
Add a checksum computing layer to the givenInputStream
.static String
getChecksumResult(InputStream chkIn)
Exctract the result from aInputStream
returned bygetChecksumInputStream(InputStream)
.static List<IContentVisualComponent>
getComponentsUseResource(ContentContext ctx, String uri)
static InputStream
getConfigFile(javax.servlet.ServletContext servletContext, String fileName)
static String[]
getDirList(String directory)
return a recursive directory array pathstatic String
getFile(String fileName)
static String
getFileContent(File file)
static String
getFileExtensionToMineType(String ext)
static File[]
getFileList(String directory)
static File[]
getFileList(String directory, javax.servlet.http.HttpServletRequest request)
static long
getFileSize(String filePath)
static File
getFreeFileName(File file)
return a free file name. if file exist add a number as suffix.static IIOMetadata
getImageMetadata(File image)
static long
getLatestModificationFileOnFolder(File folder, String... exts)
static String
getLinuxPath(String path)
convert a path to a correct path for current OS. sample: /static/images on windows -> \static\images and on unix no change.static String
getMineTypeToFileExtension(String mineType)
static String
getOSPath(String path)
convert a path to a correct path for current OS. sample: /static/images on windows -> \static\images and on unix no change.static String
getPath(String fileName)
static String
getRealPath(javax.servlet.ServletContext application, String path)
static String
getRelativeStaticURL(ContentContext ctx, File file)
static Collection<File>
getResourceWithoutMT(ContentContext ctx)
static InputStream
getStaticComponentResource(javax.servlet.ServletContext application, String componentType, String resource)
static String
getUserDirName(String userName)
static String
getWindowsFileName(String fileName)
with iexplorer the name of the file is all the path this method extract the file name from a windows pathstatic boolean
isAcceptedDocument(ContentContext ctx, String fileName)
static boolean
isAcceptedImage(ContentContext ctx, String fileName)
static boolean
isAcceptedVideo(ContentContext ctx, String fileName)
static boolean
isChildOf(File file, File folder)
check if a file (or a folder) is under a folder. sample : /tmp/test/me.jpg with /tmp retrun truestatic boolean
isComponentsUseResource(ContentContext ctx, String uri)
static boolean
isDocument(ContentContext ctx, String filename)
check if this file is a document (list of extenion define in static-config.propertiesstatic boolean
isImportPageExist(ContentContext ctx, File childImport)
static boolean
isPreviewFile(String file)
static boolean
isResourceURL(ContentContext ctx, String url)
static boolean
isSound(ContentContext ctx, String filename)
check if this file is a document (list of extenion define in static-config.propertiesstatic boolean
isTemplateFile(GlobalContext globalContext, File file)
return true if file is insise template folderstatic boolean
isTransformURL(ContentContext ctx, String url)
static Serializable
loadBeanFromXML(File file)
static Serializable
loadBeanFromXML(InputStream in)
static Serializable
loadBeanFromXML(String xml)
static Serializable
loadBeanFromXML(String xml, ClassLoader cl)
static List<String>
loadCollectionFromFile(File file)
static Properties
loadProperties(File file)
static String
loadStringFromFile(File file)
static String
loadStringFromStream(InputStream in, Charset encoding)
static void
main(String[] args)
static String
mimifyJS(String js)
static boolean
moveToGlobalTrash(StaticConfig staticConfig, String fileOrFolder)
Move a file or a folder to the global trash, depending on staticConfig.static String
readLine(RandomAccessFile file, Charset cs)
static String
removeDataFolderDir(GlobalContext globalContext, String path)
remove the data folder directory this method is used for obtain a relative file path from a ablute file path.static String
removePath(String path, String pathCuted)
remove the path from a string this method is used for obtain a relative file path from a absolute file path.static List<String>
removePrefixFromPathList(Collection<? extends Object> pathList, String prefix)
static void
renameResource(ContentContext ctx, File file, File newFile)
change all the reference to a resource when a resource path or name if changedstatic void
safeClose(Closeable... closeables)
Close streams, writers, readers, etc without any exception even if they arenull
.static String
sha256(InputStream in)
static String
sha512(File file)
static String
sha512(InputStream in)
static String
storeBean(Serializable bean, File file)
static String
storeBean(Serializable bean, OutputStream out)
static String
storeBeanFromXML(Serializable bean)
static byte[]
storeBeanToBin(Serializable bean)
static void
storeCollectionToFile(File file, List<String> lines)
static void
storeProperties(Properties prop, File file)
static void
writeBytesToFile(File file, byte[] content)
static File
writeFileItemToFolder(org.apache.commons.fileupload.FileItem fileItem, File folder, boolean overwrite, boolean rename)
static int
writeFileToFile(File fileIn, File file)
static int
writeFileToStream(File fileIn, OutputStream out)
static boolean
writeImageMetadata(IIOMetadata imageMetadata, File target)
static void
writePropertiesToFile(Properties properties, File file, String title)
static void
writePropertiesToFile(ConfigurationProperties properties, File file)
static int
writeStreamToFile(InputStream in, File file)
static int
writeStreamToFile(InputStream in, File file, long maxSize)
static int
writeStreamToStream(InputStream in, OutputStream out)
static int
writeStreamToStream(InputStream in, OutputStream out, long maxSize)
write a InputStream in a OuputStream, without close.static String
writeStreamToString(InputStream in, String encoding)
static void
writeStringToFile(File file, String content)
static void
writeStringToFile(File file, String content, String encoding)
static void
writeStringToStream(String content, OutputStream out)
static void
writeStringToStream(String content, OutputStream out, String encoding)
static void
writeUrlToFile(URL url, File imageFile)
-
-
-
Field Detail
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
-
logger
protected static Logger logger
create a static logger.
-
SYNCHRO_RESOURCE
public static Object SYNCHRO_RESOURCE
-
PRIVATE_DIR
public static final String PRIVATE_DIR
file in private dir could not be downloaded- See Also:
- Constant Field Values
-
-
Method Detail
-
closeResource
public static void closeResource(Closeable... resources)
-
closeResource
public static void closeResource(HttpURLConnection... connections)
-
computeChecksum
public static String computeChecksum(File file) throws IOException
Return the standard checksum of the specified file.
The following functions are complementary:getChecksumInputStream(InputStream)
,getChecksumResult(InputStream)
,formatChecksum(long)
- Parameters:
file
-- Returns:
- the standard checksum of the specified file
- Throws:
IOException
-
deleteFileAndParentDir
public static boolean deleteFileAndParentDir(File file)
-
downloadResource
public static void downloadResource(ContentContext ctx, String localDir, String baseURL, NodeXML nodeXML) throws Exception
- Throws:
Exception
-
downloadResourceAsString
public static String downloadResourceAsString(URL workURL) throws IOException
- Throws:
IOException
-
extractNotStaticDir
public static String extractNotStaticDir(StaticConfig staticConfig, GlobalContext globalContext, String fullPath)
extract a relative path from a full path.- Parameters:
application
- the servlet context.fullPath
- a full path- Returns:
- retrun a relative path (sample: /var/data/static/test.png -> /static/test.png)
-
extractResourceDir
public static String extractResourceDir(StaticConfig staticConfig, GlobalContext globalContext, String fullPath)
extract a relative path from a full path.- Parameters:
application
- the servlet context.fullPath
- a full path- Returns:
- retrun a relative path (sample: /var/data/static/test.png -> /test.png)
-
filteredFileCopy
public static void filteredFileCopy(File file1, File file2, Map<String,String> filter) throws IOException
- Throws:
IOException
-
copyDir
public static void copyDir(File dir1, File dir2, boolean overwrite, FileFilter filter) throws IOException
- Throws:
IOException
-
copyFile
public static boolean copyFile(File source, File destination, boolean overwrite) throws IOException
transactional copy a file other file- Parameters:
source
- the source file, must existdestination
- the target file, could not existoverwrite
- if true and file desctination exist, this method done nothing- Returns:
- true if file is copied, false otherwise
- Throws:
IOException
- error width IO, file destination is'nt modified if there are error
-
extractResourcePathFromURL
public static String extractResourcePathFromURL(ContentContext ctx, String url)
-
filteredFileCopyEscapeScriplet
public static void filteredFileCopyEscapeScriplet(File file1, File file2, Map<String,String> filter, boolean compress, boolean secure) throws IOException
- Throws:
IOException
-
getAllDirList
public static List<File> getAllDirList(File dir)
get all directories under a directory (recursivly).- Parameters:
dir
-- Returns:
- a list of directories (without files).
-
getAllFiles
public static Collection<File> getAllFiles(File dir, FileFilter filter)
-
getAllFiles
public static Collection<File> getAllFiles(File dir, FileFilter filter, Comparator<File> comp)
-
getAllFilesList
public static Collection<File> getAllFilesList(File dir)
get all files under a directory (recursivly).- Parameters:
dir
-- Returns:
- a list of files (without directories).
-
getLatestModificationFileOnFolder
public static long getLatestModificationFileOnFolder(File folder, String... exts)
-
getAllResources
public static Collection<File> getAllResources(ContentContext ctx)
-
getChecksumInputStream
public static InputStream getChecksumInputStream(InputStream in)
Add a checksum computing layer to the givenInputStream
.
Give the returnedInputStream
togetChecksumResult(InputStream)
to retrieve the checksum result.
The following functions are complementary:getChecksumResult(InputStream)
,computeChecksum(File)
,formatChecksum(long)
- Parameters:
in
-- Returns:
- an
InputStream
computing the checksum during the read, callgetChecksumResult(InputStream)
to retrieve the checksum result.
-
getChecksumResult
public static String getChecksumResult(InputStream chkIn)
Exctract the result from aInputStream
returned bygetChecksumInputStream(InputStream)
.
The following functions are complementary:getChecksumInputStream(InputStream)
,computeChecksum(File)
,formatChecksum(long)
- Parameters:
chkIn
-- Returns:
- the standard checksum of readed bytes from the given
InputStream
previously wrapped bygetChecksumInputStream(InputStream)
-
getConfigFile
public static final InputStream getConfigFile(javax.servlet.ServletContext servletContext, String fileName) throws ResourceNotFoundException
- Throws:
ResourceNotFoundException
-
getDirList
public static String[] getDirList(String directory)
return a recursive directory array path- Parameters:
directory
- the base directoryrequest
- the current request- Returns:
- a array of path
-
getFileContent
public static String getFileContent(File file) throws FileNotFoundException, IOException
- Throws:
FileNotFoundException
IOException
-
getFileList
public static File[] getFileList(String directory, javax.servlet.http.HttpServletRequest request)
-
getFileSize
public static final long getFileSize(String filePath)
-
getLinuxPath
public static final String getLinuxPath(String path)
convert a path to a correct path for current OS. sample: /static/images on windows -> \static\images and on unix no change.- Parameters:
path
- a path to a file- Returns:
- a correct file for current OS
-
getOSPath
public static final String getOSPath(String path)
convert a path to a correct path for current OS. sample: /static/images on windows -> \static\images and on unix no change.- Parameters:
path
- a path to a file- Returns:
- a correct file for current OS
-
getResourceWithoutMT
public static Collection<File> getResourceWithoutMT(ContentContext ctx) throws Exception
- Throws:
Exception
-
getStaticComponentResource
public static final InputStream getStaticComponentResource(javax.servlet.ServletContext application, String componentType, String resource) throws FileNotFoundException
- Throws:
FileNotFoundException
-
getWindowsFileName
public static String getWindowsFileName(String fileName)
with iexplorer the name of the file is all the path this method extract the file name from a windows path
-
isChildOf
public static boolean isChildOf(File file, File folder) throws IOException
check if a file (or a folder) is under a folder. sample : /tmp/test/me.jpg with /tmp retrun true- Parameters:
file
- a file, this file must be a real file or method return false.folder
- a folder (if file -> return false), this file must be a real file or method return false.- Returns:
- true if the file is under the folder.
- Throws:
IOException
-
isPreviewFile
public static boolean isPreviewFile(String file)
-
isDocument
public static boolean isDocument(ContentContext ctx, String filename)
check if this file is a document (list of extenion define in static-config.properties- Parameters:
ctx
-filename
-- Returns:
-
isSound
public static boolean isSound(ContentContext ctx, String filename)
check if this file is a document (list of extenion define in static-config.properties- Parameters:
ctx
-filename
-- Returns:
-
isResourceURL
public static boolean isResourceURL(ContentContext ctx, String url)
-
isTransformURL
public static boolean isTransformURL(ContentContext ctx, String url) throws Exception
- Throws:
Exception
-
loadProperties
public static Properties loadProperties(File file) throws IOException
- Throws:
IOException
-
storeProperties
public static void storeProperties(Properties prop, File file) throws IOException
- Throws:
IOException
-
loadStringFromStream
public static final String loadStringFromStream(InputStream in, Charset encoding) throws IOException
- Throws:
IOException
-
loadStringFromFile
public static final String loadStringFromFile(File file) throws IOException
- Throws:
IOException
-
loadCollectionFromFile
public static final List<String> loadCollectionFromFile(File file) throws IOException
- Throws:
IOException
-
storeCollectionToFile
public static final void storeCollectionToFile(File file, List<String> lines) throws IOException
- Throws:
IOException
-
appendStringToFile
public static final void appendStringToFile(File file, String line) throws IOException
- Throws:
IOException
-
moveToGlobalTrash
public static boolean moveToGlobalTrash(StaticConfig staticConfig, String fileOrFolder)
Move a file or a folder to the global trash, depending on staticConfig.- Parameters:
staticConfig
-fileOrFolder
-- Returns:
true
if origin doesn't exist; or the result ofFile.renameTo(File)
.
-
removeDataFolderDir
public static String removeDataFolderDir(GlobalContext globalContext, String path)
remove the data folder directory this method is used for obtain a relative file path from a ablute file path.- Parameters:
path
-- Returns:
-
removePath
public static String removePath(String path, String pathCuted)
remove the path from a string this method is used for obtain a relative file path from a absolute file path.- Parameters:
path
-- Returns:
-
renameResource
public static void renameResource(ContentContext ctx, File file, File newFile) throws Exception
change all the reference to a resource when a resource path or name if changed- Parameters:
ctx
-oldName
-newName
-- Throws:
Exception
-
copyResourceData
public static void copyResourceData(ContentContext ctx, File file, File newFile) throws Exception
duplicate static info of a resource to a new file- Parameters:
ctx
-oldName
-newName
-- Throws:
Exception
-
deleteResource
public static boolean deleteResource(ContentContext ctx, File file) throws Exception
- Throws:
Exception
-
deleteResourceData
public static void deleteResourceData(ContentContext ctx, File file) throws Exception
- Throws:
Exception
-
safeClose
public static void safeClose(Closeable... closeables)
Close streams, writers, readers, etc without any exception even if they arenull
.- Parameters:
closeables
- the objects to close
-
writePropertiesToFile
public static final void writePropertiesToFile(Properties properties, File file, String title) throws IOException
- Throws:
IOException
-
writePropertiesToFile
public static final void writePropertiesToFile(ConfigurationProperties properties, File file) throws IOException
- Throws:
IOException
-
writeStreamToFile
public static final int writeStreamToFile(InputStream in, File file) throws IOException
- Throws:
IOException
-
writeStreamToFile
public static final int writeStreamToFile(InputStream in, File file, long maxSize) throws IOException
- Throws:
IOException
-
writeStreamToString
public static final String writeStreamToString(InputStream in, String encoding) throws IOException
- Throws:
IOException
-
writeFileToFile
public static final int writeFileToFile(File fileIn, File file) throws IOException
- Throws:
IOException
-
writeFileToStream
public static final int writeFileToStream(File fileIn, OutputStream out) throws IOException
- Throws:
IOException
-
writeFileItemToFolder
public static final File writeFileItemToFolder(org.apache.commons.fileupload.FileItem fileItem, File folder, boolean overwrite, boolean rename) throws IOException
- Throws:
IOException
-
writeStreamToStream
public static final int writeStreamToStream(InputStream in, OutputStream out) throws IOException
- Throws:
IOException
-
writeStreamToStream
public static final int writeStreamToStream(InputStream in, OutputStream out, long maxSize) throws IOException
write a InputStream in a OuputStream, without close.- Returns:
- the size of transfered data in byte.
- Throws:
IOException
-
copyStream
public static void copyStream(InputStream input, OutputStream output, long start, long length) throws IOException
Copy the given byte range of the given input to the given output.- Parameters:
input
- The input to copy the given range to the given output for.output
- The output to copy the given range from the given input for.start
- Start of the byte range.length
- Length of the byte range.- Throws:
IOException
- If something fails at I/O level.
-
writeStringToFile
public static final void writeStringToFile(File file, String content) throws IOException
- Throws:
IOException
-
writeBytesToFile
public static final void writeBytesToFile(File file, byte[] content) throws IOException
- Throws:
IOException
-
writeStringToFile
public static final void writeStringToFile(File file, String content, String encoding) throws IOException
- Throws:
IOException
-
writeStringToStream
public static final void writeStringToStream(String content, OutputStream out, String encoding) throws IOException
- Throws:
IOException
-
writeStringToStream
public static final void writeStringToStream(String content, OutputStream out) throws IOException
- Throws:
IOException
-
getFreeFileName
public static File getFreeFileName(File file)
return a free file name. if file exist add a number as suffix.- Parameters:
file
-- Returns:
-
isTemplateFile
public static boolean isTemplateFile(GlobalContext globalContext, File file)
return true if file is insise template folder- Parameters:
globalContext
-file
-- Returns:
-
extractTemplateName
public static String extractTemplateName(GlobalContext globalContext, File file)
return the name of the template- Parameters:
globalContext
-file
-- Returns:
-
readLine
public static String readLine(RandomAccessFile file, Charset cs) throws IOException
- Throws:
IOException
-
createModulePath
public static String createModulePath(ContentContext ctx, String path) throws ModuleException, Exception
- Throws:
ModuleException
Exception
-
loadBeanFromXML
public static Serializable loadBeanFromXML(String xml)
-
loadBeanFromXML
public static Serializable loadBeanFromXML(File file) throws FileNotFoundException
- Throws:
FileNotFoundException
-
loadBeanFromXML
public static Serializable loadBeanFromXML(InputStream in)
-
loadBeanFromXML
public static Serializable loadBeanFromXML(String xml, ClassLoader cl)
-
storeBeanFromXML
public static String storeBeanFromXML(Serializable bean)
-
storeBean
public static String storeBean(Serializable bean, OutputStream out)
-
storeBean
public static String storeBean(Serializable bean, File file) throws FileNotFoundException
- Throws:
FileNotFoundException
-
storeBeanToBin
public static byte[] storeBeanToBin(Serializable bean) throws IOException
- Throws:
IOException
-
getImageMetadata
public static IIOMetadata getImageMetadata(File image) throws IOException
- Throws:
IOException
-
writeImageMetadata
public static boolean writeImageMetadata(IIOMetadata imageMetadata, File target) throws IOException
- Throws:
IOException
-
excutePost
public static String excutePost(String targetURL, String urlParameters, String contentType, String lang, String user, String pwd)
-
cleanFolderList
public static List<String> cleanFolderList(Collection<String> folders)
clear a folder list, remove '/' if found as first char and replace '\' by '/'- Parameters:
folders
-- Returns:
-
removePrefixFromPathList
public static List<String> removePrefixFromPathList(Collection<? extends Object> pathList, String prefix)
-
writeUrlToFile
public static void writeUrlToFile(URL url, File imageFile) throws IOException
- Throws:
IOException
-
canModifFolder
public static boolean canModifFolder(ContentContext ctx, String folder)
-
cleanImportResources
public static int cleanImportResources(ContentContext ctx) throws Exception
delete import without reference to a existing page.- Parameters:
ctx
-- Returns:
- nomber of deleted import folder.
- Throws:
Exception
-
isImportPageExist
public static boolean isImportPageExist(ContentContext ctx, File childImport) throws Exception
- Throws:
Exception
-
cleanImportResource
public static int cleanImportResource(ContentContext ctx, File childImport) throws Exception
- Throws:
Exception
-
getComponentsUseResource
public static List<IContentVisualComponent> getComponentsUseResource(ContentContext ctx, String uri) throws Exception
- Throws:
Exception
-
isComponentsUseResource
public static boolean isComponentsUseResource(ContentContext ctx, String uri) throws Exception
- Throws:
Exception
-
isAcceptedImage
public static boolean isAcceptedImage(ContentContext ctx, String fileName)
-
isAcceptedVideo
public static boolean isAcceptedVideo(ContentContext ctx, String fileName)
-
isAcceptedDocument
public static boolean isAcceptedDocument(ContentContext ctx, String fileName)
-
getRealPath
public static String getRealPath(javax.servlet.ServletContext application, String path)
-
cleanAllFileName
public static boolean cleanAllFileName(File file) throws IOException
normalize all file name from a dir- Parameters:
file
-- Returns:
- true one file name has changed
- Throws:
IOException
-
getRelativeStaticURL
public static String getRelativeStaticURL(ContentContext ctx, File file)
-
countLines
public static int countLines(File file) throws IOException
- Throws:
IOException
-
deleteFolder
public static boolean deleteFolder(File folder)
-
docx2html
public static void docx2html(File docx, File html) throws IOException
- Throws:
IOException
-
sha512
public static String sha512(File file) throws IOException, IllegalArgumentException
- Throws:
IOException
IllegalArgumentException
-
sha512
public static String sha512(InputStream in) throws IOException, IllegalArgumentException
- Throws:
IOException
IllegalArgumentException
-
sha256
public static String sha256(InputStream in) throws IOException, IllegalArgumentException
- Throws:
IOException
IllegalArgumentException
-
main
public static void main(String[] args) throws IOException
- Throws:
IOException
-
-