Extracts the string from the given input stream.
@param is The input stream
@return The string extracted
430329
private static String getStringFromInputStream(InputStream is)
    {
        BufferedReader br = null;
        StringBuilder sb = new StringBuilder();

        String line;
        try
        {
            br = new BufferedReader(new InputStreamReader(is));
            while((line = br.readLine()) != null)
            {
                sb.append(line);
            }

        }
        catch(IOException e)
        {
            logger.severe("Unable to get string from stream: "+e.getClass().getName()+": "+e.getMessage());
        }
        finally
        {
            try
            {
                if(br != null)
                    br.close();
            }
            catch(IOException e)
            {
            }
        }

        return sb.toString();
    }
125651
@SuppressWarnings("unchecked")
    public static <T> T readObject(InputStream is) {
        try {
            ObjectInputStream ois = new ObjectInputStream(is);
            T ret = (T) ois.readObject();
            ois.close();
            return ret;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
793604
public static InputStream getStringInputStream(String string)
    {
        InputStream is = null;
        try   {
            ByteArrayOutputStream ba = new ByteArrayOutputStream();
            DataOutputStream os = new DataOutputStream(ba);
            os.writeUTF(string);
            os.flush();
            is = new ByteArrayInputStream(ba.toByteArray());
        } catch (IOException ex)    {
            ex.printStackTrace();
        }
        return is;
    }
1034225
public static final BufferedInputStream buffer(InputStream is)
    {
        if (is instanceof BufferedInputStream)
        {
            return (BufferedInputStream) is;
        }
        else
        {
            return new BufferedInputStream(is);
        }
    }
364434
private String readFileIntoString(String fileName,  InputStream is) throws IOException {
        FileInputStream stream = null;
        InputStreamReader reader = null;
        try {
            if (is != null) {
                reader = new InputStreamReader(is, charset);
            } else {
                stream = new FileInputStream(fileName);
                reader = new InputStreamReader(stream, charset);
            }
            
            return readStreamIntoString(reader);
        } finally {
            if (reader != null) {
                reader.close();
            }
            if (stream != null) {
                stream.close();
            }
        }
    }
285166
public static String extractValue(String input) {
        int index = input.indexOf('=') + 1;
        if (0 == index || index >= input.length()) {
            return "";
        }
        return input.substring(index).trim();
    }
1227227
public static Object convertInputStreamToObject(InputStream is) throws IOException, ClassNotFoundException{
		ObjectInputStream ois = new ObjectInputStream(is);
		return ois.readObject();
	}
1056925
protected String readString(InputStream in) throws IOException {
        int length = readInt(in);
        if (length < 0) {
            return null;
        } else if (length == 0) {
            return StringUtils.EMPTY;
        } else {
            byte[] value = new byte[length];
            in.read(value);
            return StringSerializer.decode(value);
        }
    }
145418
static String readString(final InputStream is) {
        try (final Scanner s = new Scanner(is, "UTF-8")) {
            s.useDelimiter("\\A");
            if (s.hasNext()) {
                return s.next();
            } else {
                return "";
            }
        }
    }
973085
public static String inputStream2String(final InputStream is, final String charsetName) {
        if (is == null || isSpace(charsetName)) return null;
        try {
            return new String(inputStream2Bytes(is), charsetName);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }
1195323
public static Symm obtain(InputStream is) throws IOException {
	  ByteArrayOutputStream baos = new ByteArrayOutputStream();
	  try {
		  base64url.decode(is, baos);
	  } catch (IOException e) {
		  // don't give clue
		  throw new IOException("Invalid Key");
	  }
	  byte[] bkey = baos.toByteArray();
	  if(bkey.length<0x88) { // 2048 bit key
		  throw new IOException("Invalid key");
	  }
	  return baseCrypt().obtain(bkey);
  }
544025
public InputStream getInputStream()
    {
        InputStream stream=null;
        try
        {
            stream=this.commPort.getInputStream();
        }
        catch(IOException exception)
        {
            throw new FaxException("Unable to extract input stream.",exception);
        }
        
        return stream;
    }
1082000
public static BufferedReader asReader(InputStream is, Charset charset) {
		try {
			return new BufferedReader(new InputStreamReader(is, charset.toString()));
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return null;
	}
772270
protected String writeInputStreamAsString(InputStream instream) {
    String value = null;
    try {
      value = IOUtils.toString(instream, "UTF-8");
      System.out.println(value);

    } catch(IOException ioe) {
      //Do nothing
    }
    return value;
  }
1372632
private static byte[] readAllBytes(InputStream is) throws IOException {
        byte[] buffer = new byte[8192];
        ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
        int n;
        while ((n = is.read(buffer)) != -1) {
            baos.write(buffer, 0, n);
        }
        return baos.toByteArray();
    }
735677
private static String getResponseStringData(InputStream is, String charset) throws IOException {
    ByteArrayOutputStream respDataStream = new ByteArrayOutputStream();
    String result;
    try {
      byte[] b = new byte[8192];
      int len;
      while (true) {
        len = is.read(b);
        if (len <= 0) {
          is.close();
          break;
        }
        respDataStream.write(b, 0, len);
      }
      result = respDataStream.toString(charset);
    } finally {
      respDataStream.close();
    }
    return result;
  }
517806
public static final byte[] readAllBytes(InputStream is) throws IOException
    {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        byte[] buf = new byte[4096];
        int rc = is.read(buf);
        while (rc != -1)
        {
            baos.write(buf, 0, rc);
            rc = is.read(buf);
        }
        return baos.toByteArray();
    }