コード例 #1
0
ファイル: FileBackedList.cs プロジェクト: eswoosh/duplicati
 protected override string Deserialize(Stream stream, long length)
 {
     if (m_buf == null || m_buf.Length < length)
     {
         m_buf = new byte[length];
     }
     Utility.ForceStreamRead(stream, m_buf, (int)length);
     return((m_encoding ?? System.Text.Encoding.UTF8).GetString(m_buf, 0, (int)length));
 }
コード例 #2
0
 protected override string Deserialize(Stream stream, long length)
 {
     if (m_buf == null || m_buf.Length < length)
     {
         m_buf = new byte[Math.Max(MIN_BUF_SIZE, length + BUFFER_OVERSHOOT)];
     }
     Utility.ForceStreamRead(stream, m_buf, (int)length);
     return((m_encoding ?? System.Text.Encoding.UTF8).GetString(m_buf, 0, (int)length));
 }
コード例 #3
0
ファイル: FileBackedList.cs プロジェクト: yuhisa/duplicati
            public bool MoveNext()
            {
                if (m_position >= m_stream.Length)
                {
                    m_current = default(T);
                    return(false);
                }

                if (m_expectedCount != m_parent.Count)
                {
                    throw new Exception("Collection modified");
                }

                m_stream.Position = m_position;
                if (Utility.ForceStreamRead(m_stream, m_sizebuffer, m_sizebuffer.Length) != m_sizebuffer.Length)
                {
                    throw new IOException("Unexpected EOS");
                }
                var len = BitConverter.ToInt64(m_sizebuffer, 0);

                m_current   = m_deserialize(m_stream, len);
                m_position += m_sizebuffer.Length + len;
                return(true);
            }