Java IP Address to String inputStreamContent(InputStream is)

Here you can find the source of inputStreamContent(InputStream is)

Description

input Stream Content

License

Apache License

Declaration

public static String inputStreamContent(InputStream is) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {
    public static String inputStreamContent(InputStream is) throws IOException {
        StringBuilder content = new StringBuilder("");

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
        char[] buffer = new char[4096];
        int charsRead;

        try {//from   w  w  w.j a v  a 2 s.  c  om
            while ((charsRead = bufferedReader.read(buffer)) > 0) {
                content.append(buffer, 0, charsRead);
            }
        } catch (IOException e) {
            e.printStackTrace();
            throw e;
        } finally {
            bufferedReader.close();
        }

        return content.toString();
    }
}

Related

  1. convertIpToString(byte[] ip)
  2. ip2string(byte[] ip)
  3. ip2string(byte[] ips)
  4. ip2String(int ip)
  5. ipToIPv4Str(byte[] ip)