| ICU data header reader method.
Takes a ICU generated big-endian input stream, parse the ICU standard
file header and authenticates them.
Header format:
- Header size (char)
- Magic number 1 (byte)
- Magic number 2 (byte)
- Rest of the header size (char)
- Reserved word (char)
- Big endian indicator (byte)
- Character set family indicator (byte)
- Size of a char (byte) for c++ and c use
- Reserved byte (byte)
- Data format identifier (4 bytes), each ICU data has its own
identifier to distinguish them. [0] major [1] minor
[2] milli [3] micro
- Data version (4 bytes), the change version of the ICU data
[0] major [1] minor [2] milli [3] micro
- Unicode version (4 bytes) this ICU is based on.
Example of use:
try {
FileInputStream input = new FileInputStream(filename);
If (Utility.readICUDataHeader(input, dataformat, dataversion,
unicode) {
System.out.println("Verified file header, this is a ICU data file");
}
} catch (IOException e) {
System.out.println("This is not a ICU data file");
}
Parameters: inputStream - input stream that contains the ICU data header Parameters: dataFormatIDExpected - Data format expected. An array of 4 bytes information about the data format.E.g. data format ID 1.2.3.4. will became an array of {1, 2, 3, 4} Parameters: authenticate - user defined extra data authentication. This valuecan be null, if no extra authentication is needed. exception: IOException - thrown if there is a read error or when header authentication fails. |