Guest User

7.Файлове и потоци

a guest
Feb 24th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. Файлове и потоци
  2.  
  3. File – something (a resource) that stores information
  4. - Located on a storage device
  5. - Has name, size, extension and contents
  6. - Stores information as series of bytes
  7.  
  8. Two file types – text and binary
  9. Text files contain text information
  10. - Store text differently according to the encoding. E.g.:
  11. o in ASCII a character is represented by 1 byte,
  12. o in UTF8 a character is represented by 1-4 bytes
  13. Binary files – store raw sequence of bytes
  14. - can contain any data (images, sounds, multimedia, etc.)
  15. - not human-readable
  16.  
  17. Stream – the natural way to transfer data in the computer world
  18. Streams are ordered sequences of bytes – provide consecutive access to its elements
  19.  
  20.  
  21. По default повечето хард дискове четат по 4 kB наведнъж (на операция), така че 4 kB е оптималния вариант при четене на байтове
  22.  
  23. Different types of streams are available to access different data sources – file access, network access, memory streams and others
  24.  
  25. Base streams:
  26. FileStream – чете и пише във файлове
  27. MemoryStream – чете и пише в паметта
  28. NetworkStream – чете и пише по мрежата
  29.  
  30. .NET supports special streams
  31. - they work just like normal streams but provide additional functionality. E.g.:
  32. o CryptoStream – encrypts when writing, decrypts when reading
  33. o GzipStream – compresses, decompresses data
  34.  
  35. File is a static class that provides methods for quick and easy manipulation of files
  36.  
  37. Празните файлове и папки не заемат никава памет на твърдия диск. Заемат памет само във файловата система
Add Comment
Please, Sign In to add comment