Пример #1
0
 @Override
 public String readUTF() throws IOException {
   byte b = in.readByte();
   if (b == 0) {
     // full string with handle
     int handle = in.readVInt();
     String s = in.readUTF();
     handles.put(handle, s);
     return s;
   } else if (b == 1) {
     return handles.get(in.readVInt());
   } else if (b == 2) {
     // full string with handle
     int handle = in.readVInt();
     String s = in.readUTF();
     identityHandles.put(handle, s);
     return s;
   } else if (b == 3) {
     return identityHandles.get(in.readVInt());
   } else {
     throw new IOException("Expected handle header");
   }
 }
Пример #2
0
 @Override
 public void reset() throws IOException {
   in.reset();
   handles.clear();
 }
Пример #3
0
 @Override
 public void readBytes(byte[] b, int offset, int len) throws IOException {
   in.readBytes(b, offset, len);
 }
Пример #4
0
 @Override
 public byte readByte() throws IOException {
   return in.readByte();
 }
Пример #5
0
 @Override
 public void close() throws IOException {
   in.close();
 }