From 656dd23407f00a2f62af9e1c24fb0c48f626309c Mon Sep 17 00:00:00 2001 From: Oskar Wiksten Date: Thu, 18 Jul 2013 13:14:19 +0200 Subject: [PATCH] Provide explicit buffer size when reading huge translation files --- .../com/gpl/rpg/AndorsTrail/resource/TranslationLoader.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/TranslationLoader.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/TranslationLoader.java index 40632a9ce..f74c6d84f 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/TranslationLoader.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/TranslationLoader.java @@ -30,8 +30,8 @@ public final class TranslationLoader { private static BinaryMoFileParser createParser(AssetManager mgr, String translationFilename) { try { - InputStream is = mgr.open(translationFilename); - return new BinaryMoFileParser(is); + InputStream is = mgr.open(translationFilename, AssetManager.ACCESS_RANDOM); + return new BinaryMoFileParser(is); } catch (IOException e) { L.log("ERROR: Reading from translation asset \"" + translationFilename + "\" failed: " + e.toString()); return null; @@ -78,7 +78,7 @@ public final class TranslationLoader { public BinaryMoFileParser(InputStream is) throws IOException { this.is = is; - this.reader = new BufferedInputStream(is); + this.reader = new BufferedInputStream(is, is.available()); this.reader.mark(9999999); int magic = readIntLE(); if (magic != 0x950412de) throw new IOException("Invalid magic in MO file");