Exemplo n.º 1
0
        public override int Read(byte[] buffer, int offset, int count)
        {
            int            numToRead  = (int)Math.Min((long)_client.FileSystemInfo.ReadMaxBytes, count);
            Nfs3ReadResult readResult = _client.Read(_handle, _position, numToRead);

            int toCopy = Math.Min(count, readResult.Count);

            Array.Copy(readResult.Data, 0, buffer, offset, toCopy);

            if (readResult.Eof)
            {
                _length = _position + readResult.Count;
            }

            _position += toCopy;
            return(toCopy);
        }
Exemplo n.º 2
0
        public Nfs3ReadResult Read(Nfs3FileHandle fileHandle, long position, int count)
        {
            Nfs3ReadResult result = _nfsClient.Read(fileHandle, position, count);

            if (result.FileAttributes != null)
            {
                _cachedAttributes[fileHandle] = result.FileAttributes;
            }

            if (result.Status == Nfs3Status.Ok)
            {
                return(result);
            }
            else
            {
                throw new Nfs3Exception(result.Status);
            }
        }