/// <summary> /// Returns a new JetArray, the result of A ^ B /// </summary> public JetArray Xor(JetArray oprand) { // create merged buffer JetArray bytes = new JetArray(); Position = 0; oprand.Position = 0; for (uint b = 0, bl = Length; b < bl; b = (b + 1)) { bytes.WriteByte((byte)(ReadByte() ^ oprand.ReadByte())); } return(bytes); }
/// <summary> /// Append a JetArray to the end of the stream, returning a new JetArray object /// </summary> public JetArray Append(byte[] add, bool posToEnd) { // save uint curPos = Position; byte[] resultBuf = new byte[Length + add.Length]; byte[] mainBuf = ToBytes(); byte[] addBuf = add; // do a fast copy Buffer.BlockCopy(mainBuf, 0, resultBuf, 0, mainBuf.Length); Buffer.BlockCopy(addBuf, 0, resultBuf, mainBuf.Length, addBuf.Length); // restore JetArray resultBuffer = new JetArray(resultBuf); resultBuffer.Position = posToEnd ? resultBuffer.Length : curPos; return(resultBuffer); }
/// <summary> /// Append a JetArray to the end of the stream, returning a new JetArray object /// </summary> public JetArray Append(JetArray add, bool posToEnd) { return(Append(add.ToBytes(), posToEnd)); }
/// <summary> /// Create a new JetArray from the given JetArray. /// </summary> public JetArray(JetArray buffer) { stream = new MemoryStream(buffer.ToBytes()); Setup(); }
/// <summary> /// Writes a stream of bytes to the stream. /// </summary> public void WriteBytes(JetArray buffer) { WriteBytes(buffer.ToBytes()); }