Code example for EOFException

0
	public final byte[] readByteArray(int length) throws IOException {
		byte[] array=new byte[length];
		int read=m_stream.read(array);
		m_position+=read;
		if (read!=length) {
			throw new EOFException();
		} 
		return array;
	} 
	 
	public final void skip(int bytes) throws IOException {
		if (bytes<=0) {
			return; 
		} 
		long skipped=m_stream.skip(bytes);
		m_position+=skipped;
		if (skipped!=bytes) {
			throw new EOFException();
		} 
	}