public static boolean ensureZeros(RandomAccessFile raf, long position, long count) throws IOException {
		if(count<0) throw new IllegalArgumentException("count<0: "+count);
		boolean modified = false;
		byte[] buff = BufferManager.getBytes();
		try {
			while(count>BufferManager.BUFFER_SIZE) {
				raf.seek(position);
				raf.readFully(buff, 0, BufferManager.BUFFER_SIZE);
				if(!Arrays.equals(buff, zeros)) {
					raf.seek(position);
					raf.write(zeros, 0, BufferManager.BUFFER_SIZE);
					modified = true;
				}
				position += BufferManager.BUFFER_SIZE;
				count -= BufferManager.BUFFER_SIZE;
			}
			if(count>0) {
				raf.seek(position);
				raf.readFully(buff, 0, (int)count);
				if(!com.aoindustries.util.AoArrays.equals(buff, zeros, 0, (int)count)) {
					raf.seek(position);
					raf.write(zeros, 0, (int)count);
					modified = true;
				}
			}
		} finally {
			BufferManager.release(buff, false);
		}
		return modified;
	}
public static boolean ensureZeros ( RandomAccessFile raf , long position , long count ) throws IOException { if ( count < 0 ) throw new IllegalArgumentException ( "count<0: " + count ) ; boolean modified = false ; byte [ ] buff = BufferManager . getBytes ( ) ; try { while ( count > BufferManager . BUFFER_SIZE ) { raf . seek ( position ) ; raf . readFully ( buff , 0 , BufferManager . BUFFER_SIZE ) ; if ( ! Arrays . equals ( buff , zeros ) ) { raf . seek ( position ) ; raf . write ( zeros , 0 , BufferManager . BUFFER_SIZE ) ; modified = true ; } position += BufferManager . BUFFER_SIZE ; count -= BufferManager . BUFFER_SIZE ; } if ( count > 0 ) { raf . seek ( position ) ; raf . readFully ( buff , 0 , ( int ) count ) ; if ( ! com . aoindustries . util . AoArrays . equals ( buff , zeros , 0 , ( int ) count ) ) { raf . seek ( position ) ; raf . write ( zeros , 0 , ( int ) count ) ; modified = true ; } } } finally { BufferManager . release ( buff , false ) ; } return modified ; }
@ThreadSafe