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
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FileSniffer.CoreFormatTypeDetermine the format of the core file.static booleanisCoreFile(InputStream in, long filesize) static booleanisCoreFile(ImageInputStream iis, long filesize) static booleanisJavaCoreFile(InputStream in, long filesize) static booleanisJavaCoreFile(ImageInputStream iis, long filesize) static booleanisPHDFile(InputStream in, long filesize) static booleanisPHDFile(ImageInputStream iis, long filesize) static booleanstatic booleanChecks 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
-