IOS蓝牙接收数据缓存这一块,有安卓代码,我们IOS的要怎么写

/** 一次能读的最大字节长度 **/
    private static final int MAX_READLEN = 4096;
    /** 读取数据的字节长度 **/
    private int mReadCount = 0;
    /** 每次缓存数据的字节数组 **/
    private byte] mReadBuffer = new byte;    

public void onCharacteristicRead(BluetoothGatt gatt,
                BluetoothGattCharacteristic characteristic, int status) {
            if (status == BluetoothGatt.GATT_SUCCESS) {
                byte] buffer = new byte;
                int bytes;
                buffer = characteristic.getValue();
                bytes=buffer.length;
                synchronized (BluetoothLeService.this) {
                    if (mReadCount + bytes < MAX_READLEN) {
                        System.arraycopy(buffer, 0, mReadBuffer, mReadCount, bytes);
                        mReadCount += bytes;
                    } else if (mReadCount < MAX_READLEN) {
                        int count = MAX_READLEN - mReadCount;
                        System.arraycopy(buffer, 0, mReadBuffer, mReadCount, count);
                        mReadCount += count;
                    }
                }
                
                // TODO:读取数据
//                broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
            }
        }


如上,IOS蓝牙接收数据用的是NSData,我不知道要怎么做缓存,求大神帮忙

没做过这东西 看起来应该是把string发给js 在js层做缓存