am 8f4d5d5f: Fix getDictionaryFileHeader.

* commit '8f4d5d5f23fd45a88da1fc394475abe8b3e6f415':
  Fix getDictionaryFileHeader.
This commit is contained in:
Yuichiro Hanada 2013-08-23 07:11:42 -07:00 committed by Android Git Automerger
commit b9f0a7eaf2
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(