FileDocCategorySizeDatePackage
UsbAccessoryStreamTransport.javaAPI DocAndroid 5.1 API2255Thu Mar 12 22:22:42 GMT 2015com.android.accessorydisplay.source

UsbAccessoryStreamTransport

public class UsbAccessoryStreamTransport extends com.android.accessorydisplay.common.Transport
Sends or receives messages over a file descriptor associated with a {@link UsbAccessory}.

Fields Summary
private android.os.ParcelFileDescriptor
mFd
private FileInputStream
mInputStream
private FileOutputStream
mOutputStream
Constructors Summary
public UsbAccessoryStreamTransport(com.android.accessorydisplay.common.Logger logger, android.os.ParcelFileDescriptor fd)

        super(logger, 16384);
        mFd = fd;
        mInputStream = new FileInputStream(fd.getFileDescriptor());
        mOutputStream = new FileOutputStream(fd.getFileDescriptor());
    
Methods Summary
protected voidioClose()

        try {
            mFd.close();
        } catch (IOException ex) {
        }
        mFd = null;
        mInputStream = null;
        mOutputStream = null;
    
protected intioRead(byte[] buffer, int offset, int count)

        if (mInputStream == null) {
            throw new IOException("Stream was closed.");
        }
        return mInputStream.read(buffer, offset, count);
    
protected voidioWrite(byte[] buffer, int offset, int count)

        if (mOutputStream == null) {
            throw new IOException("Stream was closed.");
        }
        mOutputStream.write(buffer, offset, count);