コード例 #1
0
 @Override
 public byte[] unserialize(Reader reader, int tag, Type type) throws IOException {
   switch (tag) {
     case TagEmpty:
       return new byte[0];
     case TagBytes:
       return ReferenceReader.readBytes(reader);
     case TagList:
       return ReferenceReader.readByteArray(reader);
     case TagUTF8Char:
       return ValueReader.readUTF8Char(reader).getBytes("UTF-8");
     case TagString:
       return ReferenceReader.readString(reader).getBytes("UTF-8");
   }
   return super.unserialize(reader, tag, type);
 }
コード例 #2
0
 @Override
 public Short unserialize(Reader reader, int tag, Type type) throws IOException {
   if (tag >= '0' && tag <= '9') return (short) (tag - '0');
   if (tag == TagInteger) return (short) ValueReader.readInt(reader, TagSemicolon);
   switch (tag) {
     case TagLong:
       return (short) ValueReader.readLong(reader, TagSemicolon);
     case TagDouble:
       return Double.valueOf(ValueReader.readDouble(reader)).shortValue();
     case TagEmpty:
       return 0;
     case TagTrue:
       return 1;
     case TagFalse:
       return 0;
     case TagUTF8Char:
       return Short.parseShort(ValueReader.readUTF8Char(reader));
     case TagString:
       return Short.parseShort(ReferenceReader.readString(reader));
   }
   return super.unserialize(reader, tag, type);
 }
コード例 #3
0
 @Override
 public StringBuffer[] unserialize(Reader reader, int tag, Type type) throws IOException {
   if (tag == TagList) return ReferenceReader.readStringBufferArray(reader);
   if (tag == TagEmpty) return new StringBuffer[0];
   return super.unserialize(reader, tag, type);
 }