java.lang.Object
com.ibm.dtfj.utils.file.FileSniffer
Sniffs files attempting to determine the contents, typically from known
magic numbers/values.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic FileSniffer.CoreFormatType
Determine the format of the core file.static boolean
isCoreFile
(InputStream in, long filesize) static boolean
isCoreFile
(ImageInputStream iis, long filesize) static boolean
isJavaCoreFile
(InputStream in, long filesize) static boolean
isJavaCoreFile
(ImageInputStream iis, long filesize) static boolean
isPHDFile
(InputStream in, long filesize) static boolean
isPHDFile
(ImageInputStream iis, long filesize) static boolean
static boolean
Checks to see if the input stream is for a zip file, assumes that the stream is correctly positioned.
-
Constructor Details
-
FileSniffer
public FileSniffer()
-
-
Method Details
-
getCoreFormat
Determine the format of the core file.- Parameters:
iis
- stream to the core file- Returns:
- format
- Throws:
IOException
- re-thrown
-
isCoreFile
- Throws:
IOException
-
isCoreFile
- Throws:
IOException
-
isJavaCoreFile
- Throws:
IOException
-
isJavaCoreFile
- Throws:
IOException
-
isPHDFile
- Throws:
IOException
-
isPHDFile
- Throws:
IOException
-
isZipFile
Checks to see if the input stream is for a zip file, assumes that the stream is correctly positioned. This method will reset the stream if possible to it's starting position. The reason for using this method over just trying java.util.zip.ZipFile(File) and catching errors is that on some platforms the zip support is provided by native libraries. It is possible to cause the native library to crash when speculatively passing files into it.- Parameters:
in
- stream to analyze- Returns:
- true if it is a zip file
- Throws:
IOException
-
isZipFile
- Throws:
IOException
-