public void write(final long address, final byte[] data) throws Exception {

        if (blockCount == -1) {
            throw new IllegalStateException("You first have to open the Device!");
        }

        long blocks = data.length / blockSize;

        if (address < 0 || address + blocks > blockCount) {
            long adr = address < 0 ? address : address + blocks - 1;
            throw new IllegalArgumentException("Address " + adr + " out of range.");
        }

        if (data.length % blockSize != 0) {
            throw new IllegalArgumentException("Number of bytes is not a multiple of the blocksize!");
        }

        barrier = new CyclicBarrier(devices.length + 1);
        for (int i = 0; i < devices.length; i++) {
            executor.execute(new WriteThread(devices[i], (int)address, data));
        }
        barrier.await();
    }
public void write ( final long address , final byte [ ] data ) throws Exception { if ( blockCount == - 1 ) { throw new IllegalStateException ( "You first have to open the Device!" ) ; } long blocks = data . length / blockSize ; if ( address < 0 || address + blocks > blockCount ) { long adr = address < 0 ? address : address + blocks - 1 ; throw new IllegalArgumentException ( "Address " + adr + " out of range." ) ; } if ( data . length % blockSize != 0 ) { throw new IllegalArgumentException ( "Number of bytes is not a multiple of the blocksize!" ) ; } barrier = new CyclicBarrier ( devices . length + 1 ) ; for ( int i = 0 ; i < devices . length ; i ++ ) { executor . execute ( new WriteThread ( devices [ i ] , ( int ) address , data ) ) ; } barrier . await ( ) ; }
{@inheritDoc}