Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BufferFile : File
- {
- byte[] buffer;
- int index = 0;
- BufferFile(String name, int N) : base(name)
- {
- buffer = new byte[N];
- }
- public void write(byte b) //Zapisuje jeden byte do buffer'a
- {
- buffer[index++] = b;
- if (index == buffer.Length) writeBuffer();
- }
- public void writeBuffer() //Zapisuje cały buffer do pliku
- {
- for(int n = 0; n < index; n++) //Zapisz tylko od początku do index - 1
- {
- write(buffer[n]);
- }
- index = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement