public byte[] buildContainer() throws IOException {
   DataOutput res = new DataOutput();
   BserWriter writer = new BserWriter(res);
   writer.writeInt(1, getHeader());
   writer.writeBytes(2, toByteArray());
   return res.toByteArray();
 }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   writer.writeInt(1, this.groupId);
   if (this.ext != null) {
     writer.writeObject(2, this.ext);
   }
 }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   if (this.peer == null) {
     throw new IOException();
   }
   writer.writeObject(1, this.peer);
   writer.writeLong(2, this.startDate);
 }
Esempio n. 4
0
 @Test
 public void testLimitsBool() throws Exception {
   DataOutput dataOutput = new DataOutput();
   BserWriter writer = new BserWriter(dataOutput);
   writer.writeBool(32, true);
   writer.writeBytes(33, new byte[26]);
   byte[] data = dataOutput.toByteArray();
   BserParser.deserialize(new DataInput(data));
 }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   if (this.peer == null) {
     throw new IOException();
   }
   writer.writeObject(1, this.peer);
   writer.writeLong(2, this.rid);
   writer.writeRepeatedObj(3, this.reactions);
 }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   if (this.nextOffset != null) {
     writer.writeBytes(1, this.nextOffset);
   }
   writer.writeInt(2, this.limit);
   for (ApiUpdateOptimization i : this.optimizations) {
     writer.writeInt(3, i.getValue());
   }
 }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   if (this.groupPeer == null) {
     throw new IOException();
   }
   writer.writeObject(1, this.groupPeer);
   writer.writeLong(2, this.rid);
   for (ApiUpdateOptimization i : this.optimizations) {
     writer.writeInt(3, i.getValue());
   }
 }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   writer.writeInt(1, this.w);
   writer.writeInt(2, this.h);
   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));
     }
   }
 }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   if (this.groupPeer == null) {
     throw new IOException();
   }
   writer.writeObject(1, this.groupPeer);
   writer.writeLong(4, this.rid);
   if (this.user == null) {
     throw new IOException();
   }
   writer.writeObject(3, this.user);
 }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   if (this.settings == null) {
     throw new IOException();
   }
   writer.writeObject(1, this.settings);
 }
Esempio n. 11
0
 @Override
 public void serialize(BserWriter writer) throws IOException {
   if (this.text == null) {
     throw new IOException();
   }
   writer.writeString(1, this.text);
 }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   if (this.color == null) {
     throw new IOException();
   }
   writer.writeInt(1, this.color.getValue());
 }
Esempio n. 13
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));
     }
   }
 }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   writer.writeInt(1, this.bannerId);
   writer.writeInt(2, this.viewDuration);
 }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   writer.writeInt(1, this.timeout);
 }
Esempio n. 16
0
 @Override
 protected void perform(BserWriter writer) throws IOException {
   writer.writeRaw(new byte[] {1 << 3 | 3});
 }
Esempio n. 17
0
 @Override
 public void serialize(BserWriter writer) throws IOException {
   writer.writeRepeatedObj(1, this.items);
 }
Esempio n. 18
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);
        }
 @Override
 public void serialize(BserWriter writer) throws IOException {
   writer.writeInt(1, this.uid);
   writer.writeLong(2, this.accessHash);
 }