示例#1
0
  protected byte[] readSourcePacket() throws IOException {
    byte[] packet = new byte[packetSize];
    int offset = 0;

    while (offset < packetSize) {
      int count = is.read(packet, offset, packetSize - offset);

      if (count == -1) throw new IOException("end-of-stream");
      offset += count;
    }
    return bp.collapsePacket(packet);
  }
示例#2
0
 protected boolean writeSourcePacket(byte[] packet) throws IOException {
   os.write(bp.expandPacket(packet, packetSize));
   return true;
 }