From d188af70227ae7003fa410ccf4038a57825ae385 Mon Sep 17 00:00:00 2001 From: Yuichiro Hanada Date: Tue, 17 Sep 2013 18:20:03 +0900 Subject: Add SparseTable. Bug: 10920165 Change-Id: I749dd0269e788799e30b10beb2671813d40ce15f --- .../latin/makedict/BinaryDictEncoderUtils.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java') diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java index 3b1d2427b..6cc0bfb76 100644 --- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java +++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java @@ -225,6 +225,26 @@ public class BinaryDictEncoderUtils { return position; } + static void writeUIntToStream(final OutputStream stream, final int value, final int size) + throws IOException { + switch(size) { + case 4: + stream.write((value >> 24) & 0xFF); + /* fall through */ + case 3: + stream.write((value >> 16) & 0xFF); + /* fall through */ + case 2: + stream.write((value >> 8) & 0xFF); + /* fall through */ + case 1: + stream.write(value & 0xFF); + break; + default: + /* nop */ + } + } + // End utility methods // This method is responsible for finding a nice ordering of the nodes that favors run-time -- cgit v1.2.3-83-g751a