am 8f4d5d5f: Fix getDictionaryFileHeader.
* commit '8f4d5d5f23fd45a88da1fc394475abe8b3e6f415': Fix getDictionaryFileHeader.main
commit
b9f0a7eaf2
|
@ -517,7 +517,7 @@ public final class BinaryDictIOUtils {
|
||||||
* @param offset The offset in the file where to start reading the data.
|
* @param offset The offset in the file where to start reading the data.
|
||||||
* @param length The length of the data file.
|
* @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)
|
final File file, final long offset, final long length)
|
||||||
throws FileNotFoundException, IOException, UnsupportedFormatException {
|
throws FileNotFoundException, IOException, UnsupportedFormatException {
|
||||||
final byte[] buffer = new byte[HEADER_READING_BUFFER_SIZE];
|
final byte[] buffer = new byte[HEADER_READING_BUFFER_SIZE];
|
||||||
|
@ -528,6 +528,7 @@ public final class BinaryDictIOUtils {
|
||||||
throws FileNotFoundException, IOException {
|
throws FileNotFoundException, IOException {
|
||||||
final FileInputStream inStream = new FileInputStream(file);
|
final FileInputStream inStream = new FileInputStream(file);
|
||||||
try {
|
try {
|
||||||
|
inStream.skip(offset);
|
||||||
inStream.read(buffer);
|
inStream.read(buffer);
|
||||||
return new ByteArrayDictBuffer(buffer);
|
return new ByteArrayDictBuffer(buffer);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -281,13 +281,7 @@ public class DictionaryInfoUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FileHeader getDictionaryFileHeaderOrNull(final File file) {
|
public static FileHeader getDictionaryFileHeaderOrNull(final File file) {
|
||||||
try {
|
return BinaryDictIOUtils.getDictionaryFileHeaderOrNull(file, 0, file.length());
|
||||||
return BinaryDictIOUtils.getDictionaryFileHeader(file, 0, file.length());
|
|
||||||
} catch (UnsupportedFormatException e) {
|
|
||||||
return null;
|
|
||||||
} catch (IOException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DictionaryInfo createDictionaryInfoFromFileAddress(
|
private static DictionaryInfo createDictionaryInfoFromFileAddress(
|
||||||
|
|
Loading…
Reference in New Issue