Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Потоци в Java
- File – something (a resource) that stores information
- - Located on a storage device
- - Has name, size, extension and contents
- - Stores information as series of bytes
- Two file types – text and binary
- Text files contain text information
- - Store text differently according to the encoding. E.g.:
- o in ASCII a character is represented by 1 byte,
- o in UTF8 a character is represented by 1-4 bytes
- Binary files – store raw sequence of bytes
- - can contain any data (images, sounds, multimedia, etc.)
- - not human-readable
- Stream – the natural way to transfer data in the computer world
- Streams are ordered sequences of bytes – provide consecutive access to its elements
- По default повечето хард дискове четат по 4 kB наведнъж (на операция), така че 4 kB е оптималния вариант при четене на байтове
- Different types of streams are available to access different data sources – file access, network access, memory streams and others
- Base streams:
- FileStream – чете и пише във файлове
- MemoryStream – чете и пише в паметта
- NetworkStream – чете и пише по мрежата
- Празните файлове и папки не заемат никава памет на твърдия диск. Заемат памет само във файловата система
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement