Exemplo n.º 1
0
        public byte[] ReadBytes(int count)
        {
            if (m_buffer_pos + count <= m_buffer_len && m_buffer_len != 0)
            {
                var data = new CowArray <byte> (m_buffer, m_buffer_pos, count).ToArray();
                m_buffer_pos += count;
                return(data);
            }
            var current_pos = Position;

            if (0 == count || current_pos >= m_size)
            {
                return(new byte[0]);
            }
            var bytes = m_view.ReadBytes(m_start + current_pos, (uint)Math.Min(count, m_size - current_pos));

            Position = current_pos + bytes.Length;
            return(bytes);
        }
Exemplo n.º 2
0
 public static string GetCString(this CowArray <byte> arr, int index, int length_limit)
 {
     arr.Reclaim();
     return(Binary.GetCString(arr.ToArray(), index, length_limit));
 }