Code example for DataInput

Methods: readFully, readInt

0
	 
	/** 
	 * This constructor does not check for unacceptable sizes, and should only be used on trusted data. 
	 */ 
	public BitArray(DataInput dis) throws IOException {
		_size = dis.readInt();
		_bits = new byte[(_size + 7) / 8];
		dis.readFully(_bits);
	} 
	 
	public BitArray(DataInput dis, int maxSize) throws IOException {
		_size = dis.readInt();
		if (_size<=0 || _size>maxSize)
			throw new IOException("Unacceptable bitarray size: "+_size);
		_bits = new byte[(_size + 7) / 8];
		dis.readFully(_bits);
	} 
 
	public BitArray(int size) {
		_size = size;
		_bits = new byte[(size + 7) / 8];