add mehtod writtenBytes for getting amount of written bytes...