public OutputStream getOutput() throws IOException { return mSocket.getOutputStream(); } }
@Override public void send(byte[] packet, int len) throws IOException { if (GnirehtetService.VERBOSE) { Log.d(TAG, "Sending..." + Binary.toString(packet, len)); } localSocket.getOutputStream().write(packet, 0, len); }
@Override public void run() { try { DataInputStream input = new DataInputStream(socket.getInputStream()); DataOutputStream output = new DataOutputStream(socket.getOutputStream()); try { handle(input, output); } finally { try { input.close(); } catch (IOException ignore) { } try { output.close(); } catch (IOException ignore) { } } } catch (IOException e) { if (Log.isLoggable(Logging.LOG_TAG, Log.VERBOSE)) { Log.v(Logging.LOG_TAG, "Fatal error receiving messages", e); } } }
/** * @throws IOException */ @Override public OutputStream getOutputStream() throws IOException { return mLocalSocket.getOutputStream(); }
@Override public OutputStream getOutputStream() throws IOException { return socket.getOutputStream(); }
public SocketLike(LocalSocket socket, LeakyBufferedInputStream leakyInput) { OutputStream temp = null; try { temp = socket.getOutputStream(); } catch (IOException e) { e.printStackTrace(); } outputStream = temp; mLeakyInput = leakyInput; }
/** * @param cmd command to write to management socket * @return true if command have been sent */ public boolean managmentCommand(String cmd) { try { if (mSocket != null && mSocket.getOutputStream() != null) { mSocket.getOutputStream().write(cmd.getBytes()); mSocket.getOutputStream().flush(); return true; } } catch (IOException e) { // Ignore socket stack traces } return false; }
@Override public void run() { super.run(); try { final int VERSION = 2; BufferedOutputStream outputStream = new BufferedOutputStream(socket.getOutputStream()); while (true) { Bitmap bitmap = screenshot(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 60, byteArrayOutputStream); outputStream.write(2); writeInt(outputStream, byteArrayOutputStream.size()); outputStream.write(byteArrayOutputStream.toByteArray()); outputStream.flush(); } } catch (Throwable e) { System.out.println(e.getMessage()); } } }.start();
try { LocalSocket sender = new LocalSocket(); sender.connect(new LocalSocketAddress("MyAddress")); String data = "Hello world!"; Log.d("SENT DATA", data); sender.getOutputStream().write(data.getBytes()); sender.getOutputStream().close(); sender.close(); } catch (IOException ex) { Log.wtf("IOEXCEPTION", ex); }
@Override public void run() { try { socketHandler.handle(socket.getInputStream(), socket.getOutputStream()); } catch (IOException e) { Log.e(LOG_TAG, "Worker thread error", e); } finally { try { socket.close(); } catch (IOException e) { Log.w(LOG_TAG, "Unable to close socket"); } } } }
os = s.getOutputStream(); } catch (IOException ex) {
oos = new ObjectOutputStream(client.getOutputStream()); oos.writeObject(new String("Hello")); oos.flush();
socket.connect(sAddress); OutputStream out = socket.getOutputStream(); out.write(code); for (byte[] parameter : parameters) {
outputSocket.connect(new LocalSocketAddress(this.outputSocketAddress)); try (PrintWriter writer = new PrintWriter(outputSocket.getOutputStream())) {
@Test public void testGetOutputStream() throws Exception { OutputStream os = mock(OutputStream.class); when(mockSocket.getOutputStream()).thenReturn(os); assertSame(os, domainSocket.getOutputStream()); }
LocalProxyWorker lpw2 = new LocalProxyWorker(originalSocket.getInputStream(), localSocketRecv.getOutputStream(), "from"); Thread t1 = new Thread(lpw1); Thread t2 = new Thread(lpw2);
LocalSocket socket = new LocalSocket(); socket.connect(new LocalSocketAddress("MyAddress")); socket.getOutputStream().write(new byte[0]); socket.getOutputStream().close(); socket.close(); } catch (IOException ex) {
String outputSocketAdress = intent.getStringExtra(SOCKET_OUTPUT_EXTRA); outputSocket.connect(new LocalSocketAddress(outputSocketAdress)); try (PrintWriter writer = new PrintWriter(outputSocket.getOutputStream())) { if (resultWriter != null) { if (resultWriter instanceof WithInput) {
MessageReader reader = new MessageReader(socket.getInputStream()); writer = new MessageWriter(socket.getOutputStream()); writers.add(writer);