Example #1
0
  @Override
  public void read(Connection c) throws IOException {
    DataInputStream d = c.getDataInputStream();

    int length = d.read();
    d.readByte();
    set(Const.LENGTH, length);
    readOffSet(c);

    d.close();
  }
Example #2
0
  @Override
  public void readOffSet(Connection c) throws IOException {
    DataInputStream d = c.getDataInputStream();
    int length = (Integer) get(Const.LENGTH);
    int blockLength = length - 9;
    d.readByte();
    int index = d.read();
    int begin = d.read();
    byte[] data = new byte[blockLength];
    d.readFully(data);

    set(Const.INDEX, index);
    set(Const.BEGIN, begin);
    set(Const.DATA, data);

    d.close();
  }