コード例 #1
0
        @Override
        protected void perform(BserWriter writer) throws IOException {
          writer.writeInt(1, 1);
          writer.writeInt(1, 2);
          writer.writeInt(1, 3);
          writer.writeInt(1, 4);
          writer.writeInt(1, 5);

          writer.writeInt(2, 6);

          writer.writeBytes(3, new byte[0]);
          writer.writeBytes(3, new byte[0]);

          writer.writeLongFixed(4, 0);
          writer.writeIntFixed(5, 0);

          writer.writeString(6, "???");

          writer.writeBool(7, true);
          writer.writeBool(7, false);

          writer.writeDouble(8, 0);

          writer.writeLong(9, 0);

          writer.writeObject(10, new EmptyBserObj());

          List<EmptyBserObj> objs = new ArrayList<EmptyBserObj>();
          objs.add(new EmptyBserObj());
          writer.writeRepeatedObj(11, objs);
        }
コード例 #2
0
 @Override
 public void serialize(BserWriter writer) throws IOException {
   if (this.text == null) {
     throw new IOException();
   }
   writer.writeString(1, this.text);
 }
コード例 #3
0
 @Override
 public void serialize(BserWriter writer) throws IOException {
   if (this.command == null) {
     throw new IOException();
   }
   writer.writeString(1, this.command);
   if (this.args == null) {
     throw new IOException();
   }
   writer.writeString(2, this.args);
   if (this.getUnmappedObjects() != null) {
     SparseArray<Object> unmapped = this.getUnmappedObjects();
     for (int i = 0; i < unmapped.size(); i++) {
       int key = unmapped.keyAt(i);
       writer.writeUnmapped(key, unmapped.get(key));
     }
   }
 }