Code example for UsbEndpoint

Methods: getMaxPacketSize

0
    } 
 
    @Override 
    public int read(byte[] dest, int timeoutMillis) throws IOException {
        int readAmt = Math.min(dest.length, mReadBuffer.length);
        readAmt = Math.min(readAmt, mReadEndpoint.getMaxPacketSize());
        final int transferred = mConnection.bulkTransfer(mReadEndpoint, mReadBuffer, readAmt,
                timeoutMillis);
 
        if (transferred < 0) {
            // This sucks: we get -1 on timeout, not 0 as preferred. 
            // We *should* use UsbRequest, except it has a bug/api oversight 
            // where there is no way to determine the number of bytes read 
            // in response :\ -- http://b.android.com/28023 
            return 0; 
        } 
        System.arraycopy(mReadBuffer, 0, dest, 0, transferred);
        return transferred;
    } 
 
Contextual code suggestions in your IDE  Get Codota for Java