mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
am 8f4d5d5f
: Fix getDictionaryFileHeader.
* commit '8f4d5d5f23fd45a88da1fc394475abe8b3e6f415': Fix getDictionaryFileHeader.
This commit is contained in:
commit
b9f0a7eaf2
@ -517,7 +517,7 @@ public final class BinaryDictIOUtils {
|
||||
* @param offset The offset in the file where to start reading the data.
|
||||
* @param length The length of the data file.
|
||||
*/
|
||||
public static FileHeader getDictionaryFileHeader(
|
||||
private static FileHeader getDictionaryFileHeader(
|
||||
final File file, final long offset, final long length)
|
||||
throws FileNotFoundException, IOException, UnsupportedFormatException {
|
||||
final byte[] buffer = new byte[HEADER_READING_BUFFER_SIZE];
|
||||
@ -528,6 +528,7 @@ public final class BinaryDictIOUtils {
|
||||
throws FileNotFoundException, IOException {
|
||||
final FileInputStream inStream = new FileInputStream(file);
|
||||
try {
|
||||
inStream.skip(offset);
|
||||
inStream.read(buffer);
|
||||
return new ByteArrayDictBuffer(buffer);
|
||||
} finally {
|
||||
|
@ -281,13 +281,7 @@ public class DictionaryInfoUtils {
|
||||
}
|
||||
|
||||
public static FileHeader getDictionaryFileHeaderOrNull(final File file) {
|
||||
try {
|
||||
return BinaryDictIOUtils.getDictionaryFileHeader(file, 0, file.length());
|
||||
} catch (UnsupportedFormatException e) {
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
return BinaryDictIOUtils.getDictionaryFileHeaderOrNull(file, 0, file.length());
|
||||
}
|
||||
|
||||
private static DictionaryInfo createDictionaryInfoFromFileAddress(
|
||||
|
Loading…
Reference in New Issue
Block a user