Beispiel #1
0
        /// <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);
        }
Beispiel #2
0
        /// <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);
        }
Beispiel #3
0
 /// <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));
 }
Beispiel #4
0
 /// <summary>
 /// Create a new JetArray from the given JetArray.
 /// </summary>
 public JetArray(JetArray buffer)
 {
     stream = new MemoryStream(buffer.ToBytes());
     Setup();
 }
Beispiel #5
0
 /// <summary>
 /// Writes a stream of bytes to the stream.
 /// </summary>
 public void WriteBytes(JetArray buffer)
 {
     WriteBytes(buffer.ToBytes());
 }