Package org.robovm.libimobiledevice
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 IDeviceConnectionRefref -
Method Summary
Modifier and Type Method Description protected voidcheckDisposed()voidclose()voiddisconnect()Disconnects from the device.voiddispose()java.io.InputStreamgetInputStream()Returns anInputStreamfor reading from thisIDeviceConnection.java.io.OutputStreamgetOutputStream()Returns andOutputStreamfor writing to thisIDeviceConnection.protected IDeviceConnectionRefgetRef()intreceive(byte[] buffer, int offset, int count)Receives data from the device.intreceive(byte[] buffer, int offset, int count, int timeout)Receives data from the device.intsend(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
-
ref
-
-
Method Details
-
getRef
-
getInputStream
public java.io.InputStream getInputStream()Returns anInputStreamfor reading from thisIDeviceConnection. -
getOutputStream
public java.io.OutputStream getOutputStream()Returns andOutputStreamfor writing to thisIDeviceConnection. -
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 inbufferto store the received bytes.count- the maximum number of bytes to store inbuffer.- 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 inbufferto store the received bytes.count- the maximum number of bytes to store inbuffer.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 inbufferfrom where to get bytes.count- the number of bytes frombufferto send.- Returns:
- the number of bytes actually sent.
-
disconnect
public void disconnect() -
checkDisposed
protected final void checkDisposed() -
dispose
public void dispose() -
close
public void close()- Specified by:
closein interfacejava.lang.AutoCloseable
-