misiek said:
dlugosc = File.length()
(a) Using File.length() is a bad idea. File sizes can and do change
while you read. E.g. all it takes is that someone deletes the file
between the moment you called File.length() and while you use the data.
(b) Using binary I/O when you want to do text I/O is a rather bad idea, too.
(c) Converting the buffer to a string without taking the just read
'bytesRead' size into account is a bad idea. The array might only be
half filled, but the String() constructor doesn't know about this.
(d) Doing the conversion (which should not be done, see (b)), without
specifying a charset is a bad idea. Java will use the platform's default
which might or might not the the right one.
Please work through Sun's I/O tutorial at
http://java.sun.com/docs/books/tutorial/essential/io/index.html
Oh, and beginners questions are best asked in comp.lang.java.help
/Thomas