Added the code to check whether size field of data was successfully read into method readBytesAndSize and use that method in readNextUrl and readNextData.