Java Socket Read getInputStreamFromSocket(final Socket socket)

Here you can find the source of getInputStreamFromSocket(final Socket socket)

Description

Returns a InputStream from the specified socket

License

Open Source License

Parameter

Parameter Description
socket the socket the inputstream is connected to.

Exception

Parameter Description
IOException if a error occurs while connecting to the server.

Return

the input stream connected to the specified socket.

Declaration

public static InputStream getInputStreamFromSocket(final Socket socket)
        throws IOException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 Joe Beeton./*w ww .  j a va2  s . c  o m*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     Joe Beeton - initial API and implementation
 ******************************************************************************/

import java.io.IOException;
import java.io.InputStream;

import java.net.Socket;

public class Main {
    /**
     * Returns a InputStream from the specified socket
     * @param socket the socket the inputstream is connected to.
     * @return the input stream connected to the specified socket.
     * @throws IOException if a error occurs while connecting to the server.
     */
    public static InputStream getInputStreamFromSocket(final Socket socket)
            throws IOException {
        return socket.getInputStream();
    }
}

Related

  1. dump(final Socket socket)
  2. getBufferedReader(Socket s)
  3. getBufferedReaderFromInputStream(Socket socket)
  4. getInputStream(Socket socket)
  5. getPrintWriter(Socket s)
  6. getPrintWriterFromOutputStream(Socket socket)
  7. getResponse(Socket socket)
  8. readBytesIntoSocket(Socket socket)