Пример #1
0
  private void readPattern(BufferedInputStream in, Pattern p) throws IOException {
    // Pattern header length
    read(in, 4);

    // Packing type (always 0)
    in.read();

    // Number of rows in pattern (1...256)
    int rows = make16Bit(read(in, 2));

    // Packed patterndata size
    int size = make16Bit(read(in, 2));

    int data[];
    if (size == 0) {
      data = new int[0];
    } else {
      byte[] b = read(in, size);
      data = new int[size];
      for (int i = 0; i < size; i++) {
        data[i] = b[i];
      }
    }
    p.setData(data);
    p.setRows(rows);
  }