Added a 'remaining' method that tells how many bytes can be read or written. Also made sure the file.read/write methods can handle partial data returns.