private void sendData(APDU apdu, byte[] buffer, short len) {
        apdu.setOutgoing();
       if (len > (short)254) {
            apdu.setOutgoingLength((short)254);
            apdu.sendBytesLong(buffer, remainingDataOffset, (short)254);
            remainingDataOffset += 254;
            remainingDataLength = (short)(len - 254);
            ISOException.throwIt((short)(SW_MORE_DATA + ((remainingDataLength > 254) ? 254 : remainingDataLength)));
        } else {
            apdu.setOutgoingLength(len);
            apdu.sendBytesLong(buffer, remainingDataOffset, len);
        }
    }