From d73d04b09d03d3e618412650a44eb726ea92283c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9C=B0=E5=B9=B3=E7=BA=BF?= <22250530@qq.com> Date: Tue, 3 Nov 2015 09:59:39 +0800 Subject: [PATCH] --- .../wentch/redkale/convert/bson/BsonWriter.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/android-jdk6-redkale/src/com/wentch/redkale/convert/bson/BsonWriter.java b/android-jdk6-redkale/src/com/wentch/redkale/convert/bson/BsonWriter.java index 09ecaf7e0..fb5d1a4f2 100644 --- a/android-jdk6-redkale/src/com/wentch/redkale/convert/bson/BsonWriter.java +++ b/android-jdk6-redkale/src/com/wentch/redkale/convert/bson/BsonWriter.java @@ -94,6 +94,23 @@ public final class BsonWriter implements Writer { System.arraycopy(chs, 0, content, position, chs.length); } + public void writeTo(int position, short value) { + writeTo(position, (byte) (value >> 8), (byte) value); + } + + public void writeTo(int position, char value) { + writeTo(position, (byte) ((value & 0xFF00) >> 8), (byte) (value & 0xFF)); + } + + public void writeTo(int position, int value) { + writeTo(position, (byte) (value >> 24), (byte) (value >> 16), (byte) (value >> 8), (byte) value); + } + + public void writeTo(int position, long value) { + writeTo(position, (byte) (value >> 56), (byte) (value >> 48), (byte) (value >> 40), (byte) (value >> 32), + (byte) (value >> 24), (byte) (value >> 16), (byte) (value >> 8), (byte) value); + } + public void writeTo(final byte ch) { expand(1); content[count++] = ch;