code: func (f *StreamFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error {
  	if len(f.Data) == 0 && !f.FinBit {
  		return errors.New("StreamFrame: attempting to write empty frame without FIN")
  	}
  
  	typeByte := byte(0x8)
  	if f.FinBit {
  		typeByte ^= 0x1
  	}
  	hasOffset := f.Offset != 0
  	if f.DataLenPresent {
  		typeByte ^= 0x2
  	}
  	if hasOffset {
  		typeByte ^= 0x4
  	}
  	b.WriteByte(typeByte)
  	utils.WriteVarInt(b, uint64(f.StreamID))
  	if hasOffset {
  		utils.WriteVarInt(b, uint64(f.Offset))
  	}
  	if f.DataLenPresent {
  		utils.WriteVarInt(b, uint64(f.DataLen()))
  	}
  	b.Write(f.Data)
  	return nil
  }
docs: // Write writes a STREAM frame