Class IDeviceConnection

java.lang.Object
org.robovm.libimobiledevice.IDeviceConnection
All Implemented Interfaces:
java.lang.AutoCloseable

public class IDeviceConnection
extends java.lang.Object
implements java.lang.AutoCloseable
Represents a device connection.
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected IDeviceConnectionRef ref  
  • Method Summary

    Modifier and Type Method Description
    protected void checkDisposed()  
    void close()  
    void disconnect()
    Disconnects from the device.
    void dispose()  
    java.io.InputStream getInputStream()
    Returns an InputStream for reading from this IDeviceConnection.
    java.io.OutputStream getOutputStream()
    Returns and OutputStream for writing to this IDeviceConnection.
    protected IDeviceConnectionRef getRef()  
    int receive​(byte[] buffer, int offset, int count)
    Receives data from the device.
    int receive​(byte[] buffer, int offset, int count, int timeout)
    Receives data from the device.
    int send​(byte[] buffer, int offset, int count)
    Sends data to the device on this connection.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • getRef

      protected IDeviceConnectionRef getRef()
    • getInputStream

      public java.io.InputStream getInputStream()
      Returns an InputStream for reading from this IDeviceConnection.
    • getOutputStream

      public java.io.OutputStream getOutputStream()
      Returns and OutputStream for writing to this IDeviceConnection.
    • receive

      public int receive​(byte[] buffer, int offset, int count)
      Receives data from the device. Waits indefinitely for data on the connection.
      Parameters:
      buffer - the byte array in which to store the received data.
      offset - the initial position in buffer to store the received bytes.
      count - the maximum number of bytes to store in buffer.
      Returns:
      the number of bytes received.
    • receive

      public int receive​(byte[] buffer, int offset, int count, int timeout)
      Receives data from the device. Returns after the given timeout even if no data has been received.
      Parameters:
      buffer - the byte array in which to store the received data.
      offset - the initial position in buffer to store the received bytes.
      count - the maximum number of bytes to store in buffer.
      timeout - timeout in milliseconds after which this method will return even if no data has been received.
      Returns:
      the number of bytes received.
    • send

      public int send​(byte[] buffer, int offset, int count)
      Sends data to the device on this connection.
      Parameters:
      buffer - the buffer to be sent.
      offset - the start position in buffer from where to get bytes.
      count - the number of bytes from buffer to send.
      Returns:
      the number of bytes actually sent.
    • disconnect

      public void disconnect()
      Disconnects from the device. This is the same as calling dispose() or close().
    • checkDisposed

      protected final void checkDisposed()
    • dispose

      public void dispose()
    • close

      public void close()
      Specified by:
      close in interface java.lang.AutoCloseable