Fix getDictionaryFileHeader.

Change-Id: I5186f41b0f38eb08f4154f7b3de7ffc2119fc44b
This commit is contained in:
Yuichiro Hanada 2013-08-23 22:39:36 +09:00
parent e9a10ff0f0
commit 8f4d5d5f23
2 changed files with 3 additions and 8 deletions

View file

@ -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 {

View file

@ -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(