private byte[] Read(int length, FieldFormat fieldFormat) { byte[] bytes = new byte[length]; int readBytes = _stream.Read(bytes); if (readBytes == 0) // note : -1 in java { throw new EndOfFileException(); } if (readBytes < length) { throw new FieldParsingException(fieldFormat, bytes); } return bytes; }