Пример #1
0
  void write(byte[] buf, int off) {
    if (_buf != null) throw new RuntimeException("Can write only locally built INIT chunks!");

    if (buf == null) throw new IllegalArgumentException("Invalid argument!");

    if (buf.length < off + INIT_CHUNK_LENGTH)
      throw new RuntimeException("Not enough space in destination buffer!");

    writeHeader(buf, off);

    ByteConverter.fromUnsignedIntTo4Bytes(_validation, buf, off + Chunk.CHUNK_HEADER_SIZE);
    ByteConverter.fromUnsignedIntTo4Bytes(
        _initialControlTSN, buf, off + Chunk.CHUNK_HEADER_SIZE + 4);
    ByteConverter.fromUnsignedIntTo4Bytes(
        _initialRelSeqTSN, buf, off + Chunk.CHUNK_HEADER_SIZE + 8);
    ByteConverter.fromUnsignedIntTo4Bytes(
        _initialUnrelSeqTSN, buf, off + Chunk.CHUNK_HEADER_SIZE + 12);
    ByteConverter.fromUnsignedIntTo4Bytes(
        _initialRelUnseqID, buf, off + Chunk.CHUNK_HEADER_SIZE + 16);
    ByteConverter.fromUnsignedIntTo4Bytes(
        _initialUnrelUnseqID, buf, off + Chunk.CHUNK_HEADER_SIZE + 20);
  }