Package mungbean.protocol

Examples of mungbean.protocol.LittleEndianDataReader


                    'o', 'k', 0, // 'ok'
                    0, 0, 0, 0, 0, 0, -16, 63, // 1
                    0 // eoo
            };
            ListQueryCallback<Map<String, Object>> callback = new ListQueryCallback<Map<String, Object>>();
            QueryResponse<Map<String, Object>> response = new QueryResponse<Map<String, Object>>(new LittleEndianDataReader(new ByteArrayInputStream(bytes)), new BSONMap(), new MapBSONCoders());
            response.readResponse(callback);
            return callback.values();
        }
View Full Code Here


            context.write(new MapBSONCoders(), "foo", map, new LittleEndianDataWriter(out));
            specify(out.toByteArray(), does.containExactly(MAP_FIXTURE));
        }

        public void mapCanBeDecodedFromBson() {
            LittleEndianDataReader reader = new LittleEndianDataReader(new ByteArrayInputStream(MAP_FIXTURE));
            specify(reader.readByte(), does.equal((byte) 3));
            specify(context.readPath(reader, ""), does.equal("foo"));
            Map<String, Object> ret = context.read(new MapBSONCoders(), reader);
            specify(ret.get("foo"), does.equal(1));
            specify(ret.get("bar"), new HashMap<String, Object>() {
                {
View Full Code Here

        public BSONBoolean create() {
            return new BSONBoolean();
        }

        public void trueBooleanCanBeDecodedFromBson() {
            specify(context.decode(null, new LittleEndianDataReader(new ByteArrayInputStream(new byte[] { 1 }))), does.equal(true));
        }
View Full Code Here

            context.write(new MapBSONCoders(), "foo", "bar", new LittleEndianDataWriter(out));
            specify(out.toByteArray(), does.containExactly(new byte[] { 2, 'f', 'o', 'o', 0, 0, 0, 0, 4, 'b', 'a', 'r', 0 }));
        }

        public void stringValueCanBeDecodedFromBson() {
            specify(context.decode(new MapBSONCoders(), new LittleEndianDataReader(new ByteArrayInputStream(new byte[] { 0, 0, 0, 3, 'f', 'o', 'o', 0 }))), does.equal("foo"));
        }
View Full Code Here

            context.write(new MapBSONCoders(), "foo", 123D, new LittleEndianDataWriter(out));
            specify(out.toByteArray(), does.containExactly(new byte[] { 1, 'f', 'o', 'o', 0, 0, 0, 0, 0, 0, -64, 94, 64 }));
        }

        public void doubleValueCanBeDecodedFromBson() {
            specify(context.decode(null, new LittleEndianDataReader(new ByteArrayInputStream(new byte[] { 0, 0, 0, 0, 0, -64, 94, 64 }))), does.equal(123D));
        }
View Full Code Here

            specify(out.toByteArray(), does.containExactly(new byte[] { 19, 0, 0, 0, 16, 48, 0, 1, 0, 0, 0, 16, 49, 0, 2, 0, 0, 0, 0 }));
        }

        public void bsonCanBeDecodedIntoListOfIntegers() {
            ByteArrayInputStream in = new ByteArrayInputStream(new byte[] { 18, 0, 0, 0, 16, 48, 0, 1, 0, 0, 0, 16, 49, 0, 2, 0, 0, 0, 0 });
            List<?> ret = context.decode(new MapBSONCoders(), new LittleEndianDataReader(in));
            specify(ret, containsExactly(1, 2));
        }
View Full Code Here

            context.write(new MapBSONCoders(), "foo", map, new LittleEndianDataWriter(out));
            specify(out.toByteArray(), does.containExactly(MAP_FIXTURE));
        }

        public void mapCanBeDecodedFromBson() {
            LittleEndianDataReader reader = new LittleEndianDataReader(new ByteArrayInputStream(MAP_FIXTURE));
            specify(reader.readByte(), does.equal((byte) 3));
            specify(context.readPath(reader, ""), does.equal("foo"));
            Map<String, Object> ret = context.read(new MapBSONCoders(), reader);
            specify(ret.get("foo"), does.equal(1));
            specify(ret.get("bar"), does.equal("zap"));
        }
View Full Code Here

TOP

Related Classes of mungbean.protocol.LittleEndianDataReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.