Package org.javacc.utils
Class OutputFileDigest
- java.lang.Object
-
- org.javacc.utils.OutputFileDigest
-
abstract class OutputFileDigest extends java.lang.ObjectTheOutputFileDigestclass.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classOutputFileDigest.NullOutputStreamTheOutputFileDigest.NullOutputStreamimplements anOutputStreamto the null device.
-
Field Summary
Fields Modifier and Type Field Description private static char[]HEX_DIGITSprivate static java.lang.StringMD5_LINE_PART_1private static java.lang.StringMD5_LINE_PART_1qprivate static java.lang.StringMD5_LINE_PART_2private static java.lang.StringMD5_LINE_PART_2q
-
Constructor Summary
Constructors Modifier Constructor Description privateOutputFileDigest()Constructs an instance ofOutputFileDigest.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancheck(java.io.File file, java.lang.String toolName, java.lang.String compatibleVersion, java.util.List<java.lang.String> options, Context context)Check if the File already exists.private static voidcheckOptions(java.io.File file, java.lang.String[] options, Context context)Read the options line from the file and compare to the options currently in use.private static voidcheckVersion(java.io.File file, java.lang.String toolName, java.lang.String versionId, Context context)Output a warning if the file was created with an incompatible version of JavaCC.static java.lang.StringgetDigestLine(java.security.DigestOutputStream digestStream)Creates the Digest Line.static java.security.DigestOutputStreamgetDigestStream(java.io.OutputStream stream)Create an MD5DigestOutputStreamfor the providedOutputStream.private static java.lang.StringtoHexString(java.security.DigestOutputStream digestStream)
-
-
-
Field Detail
-
MD5_LINE_PART_1
private static final java.lang.String MD5_LINE_PART_1
- See Also:
- Constant Field Values
-
MD5_LINE_PART_1q
private static final java.lang.String MD5_LINE_PART_1q
- See Also:
- Constant Field Values
-
MD5_LINE_PART_2
private static final java.lang.String MD5_LINE_PART_2
- See Also:
- Constant Field Values
-
MD5_LINE_PART_2q
private static final java.lang.String MD5_LINE_PART_2q
- See Also:
- Constant Field Values
-
HEX_DIGITS
private static final char[] HEX_DIGITS
-
-
Constructor Detail
-
OutputFileDigest
private OutputFileDigest()
Constructs an instance ofOutputFileDigest.
-
-
Method Detail
-
getDigestLine
public static java.lang.String getDigestLine(java.security.DigestOutputStream digestStream)
Creates the Digest Line.- Parameters:
digestStream-
-
getDigestStream
public static java.security.DigestOutputStream getDigestStream(java.io.OutputStream stream) throws java.security.NoSuchAlgorithmExceptionCreate an MD5DigestOutputStreamfor the providedOutputStream.- Parameters:
stream-- Throws:
java.security.NoSuchAlgorithmException
-
check
public static boolean check(java.io.File file, java.lang.String toolName, java.lang.String compatibleVersion, java.util.List<java.lang.String> options, Context context) throws java.io.FileNotFoundException, java.io.IOExceptionCheck if the File already exists.- Parameters:
file-toolName-compatibleVersion-options-- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
checkVersion
private static void checkVersion(java.io.File file, java.lang.String toolName, java.lang.String versionId, Context context)Output a warning if the file was created with an incompatible version of JavaCC.- Parameters:
file-toolName-versionId-
-
checkOptions
private static void checkOptions(java.io.File file, java.lang.String[] options, Context context)Read the options line from the file and compare to the options currently in use. Output a warning if they are different.- Parameters:
file-options-
-
toHexString
private static java.lang.String toHexString(java.security.DigestOutputStream digestStream)
-
-