/** * {@inheritDoc} */ @Override public Void call() throws Exception { LOG.info( "Prematurely finishing RLE-enabled capture ..." ); final DataOutputStream outputStream = this.connection.openDataOutputStream(); // Write a single command to stop RLE from doing its job... outputStream.writeByte( CMD_RLE_FINISH_NOW ); // Make sure nothing keeps lingering in the streams' buffer... outputStream.flush(); return null; } }
public void start(IchtyometerClient client) throws IOException { Preconditions.checkNotNull(client, "client can not be null"); Preconditions.checkState(client.isOpen(), "client must be opened"); this.client = client; // create a service executor this.service = Executors.newSingleThreadScheduledExecutor(); // get bluetooth connection this.connection = client.openConnection(); // get input stream (to read) this.dataInputStream = connection.openDataInputStream(); // get output stream (to write) this.dataOutputStream = connection.openDataOutputStream(); // engine is ready if (log.isDebugEnabled()) { log.debug("Ready to read remote device..."); } }
while (true) { StreamConnection sc = scn.acceptAndOpen(); final RemoteDevice rd = RemoteDevice.getRemoteDevice(sc); new Thread() { public void run() { treatConnection(rd); } }.start(); } private void treatConnection(RemoteDevice rd) { DataInputStream input = sc.openDataInputStream(); DataOutputStream output = sc.openDataOutputStream(); String inMsg = input.readUTF(); while (inMsg != null) { // not sure about this stop condition... System.out.println(inMsg + " recived at " + new Date().toString()); output.writeUTF("Hey client Sent at " + new Date().toString()); output.flush(); inMsg = input.readUTF(); } }
this.outputStream = new SumpCommandWriter( this.config, conn.openDataOutputStream() ); this.inputStream = new SumpResultReader( conn.openDataInputStream() );
outputStream = connection.openDataOutputStream();