public setData ( Byte buf, int length ) : void | ||
buf | Byte | |
length | int | |
Результат | void |
private void ReadLink(rpcCracker cracker, rpcPacker packer) { fhandle fh = new fhandle(cracker); FileStream fs; try { fs = new FileStream(FileTable.LookupFileEntry(fh).Name, FileMode.Open, FileAccess.Read); } catch (System.IO.FileNotFoundException) { FileTable.Remove(fh); throw; } try { Byte[] buf = new Byte[MAXPATHLEN]; int bytesRead = fs.Read(buf, 0, MAXPATHLEN); packer.setUint32((uint)NFSStatus.NFS_OK); packer.setData(buf, buf.Length); } finally { fs.Close(); } }
private void Read(rpcCracker cracker, rpcPacker packer) { fhandle fh = new fhandle(cracker); uint offset = cracker.get_uint32(); uint count = cracker.get_uint32(); uint totalCount = cracker.get_uint32(); FileStream fs; try { fs = new FileStream(FileTable.LookupFileEntry(fh).Name, FileMode.Open, FileAccess.Read); } catch (System.IO.FileNotFoundException) { FileTable.Remove(fh); throw; } try { fs.Position = offset; Byte[] buf = new Byte[count]; int bytesRead = fs.Read(buf, 0, (int)count); fattr attr = new fattr(fh); if (attr.IsFile() == false) throw new NFSStatusException(NFSStatus.NFSERR_ISDIR); packer.setUint32((uint)NFSStatus.NFS_OK); attr.Pack(packer); packer.setData(buf, bytesRead); } finally { fs.Close(); } }