Used for debugging

@param instream
@return
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;
  }
228297
public static List<String> linesFrom(InputStream is) {
        ArrayList<String> lines = new ArrayList<String>();
        for (String line : new LineReader(is)) {
            if (line.length() > 0 && !line.startsWith("#"))
                lines.add(line);
        }
        return lines;
    }
618712
public static StaticBody fromStream(
            final InputStream inStream)
            throws BOSHException {
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        try {
            byte[] buffer = new byte[BUFFER_SIZE];
            int read;
            do {
                read = inStream.read(buffer);
                if (read > 0) {
                    byteOut.write(buffer, 0, read);
                }
            } while (read >= 0);
        } catch (IOException iox) {
            throw(new BOSHException(
                    "Could not read body data", iox));
        }
        return fromString(byteOut.toString());
    }
24989
public static Pair<String, String> readStringPair(DataInputStream in) {
    Pair<String, String> p = new Pair<String, String>();
    try {
      p.first = in.readUTF();
      p.second = in.readUTF();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return p;
  }
1363863
private static byte[] readStream(final InputStream in) throws IOException {
    final ByteArrayOutputStream bos = new ByteArrayOutputStream();
    final byte[] data = new byte[4096];
    int bytesRead;
    while ((bytesRead = in.read(data, 0, data.length)) != -1) {
      bos.write(data, 0, bytesRead);
    }
    return bos.toByteArray();
  }
179586
public static void copyStream(InputStream inStream, OutputStream outStream, boolean ignoreErrors)
    {
        byte[] data = new byte[BUFFER];
        int count;
        try {
            while((count = inStream.read(data, 0, BUFFER)) != -1)
            {
                outStream.write(data, 0, count);
            }
        } catch (IOException e) {
            if (!ignoreErrors)
                e.printStackTrace();
        }
    }
688593
public static IDLProxyObject createSingle(InputStream is, boolean debug) throws IOException {
        return createSingle(is, debug, null, true);
    }
860177
public static List<FastaSequence> readFasta(final InputStream inStream)
		throws IOException {
	final List<FastaSequence> seqs = new ArrayList<FastaSequence>();

	final BufferedReader infasta = new BufferedReader(
		new InputStreamReader(inStream, "UTF8"), 16000);
	final Pattern pattern = Pattern.compile("//s+");

	String line;
	String sname = "", seqstr = null;
	do {
		line = infasta.readLine();
		if ((line == null) || line.startsWith(">")) {
		if (seqstr != null) {
			seqs.add(new FastaSequence(sname.substring(1), seqstr));
		}
		sname = line; // remove >
		seqstr = "";
		} else {
		final String subseq = pattern.matcher(line).replaceAll("");
		seqstr += subseq;
		}
	} while (line != null);

	infasta.close();
	return seqs;
	}
34162
public static Layout parseStream(InputStream stream) {
        try (InputStream is = stream) {
            return parseDocument(XMLUtil.parseXMLFromStream(is));
        } catch (Exception e) {
            throw MiscUtil.toUnchecked(e);
        }
    }
826613
public long copy(InputStream in, Node dest) throws IOException {
        long result;

        try (OutputStream out = dest.newOutputStream()) {
            result = copy(in, out);
        }
        return result;
    }
1240809
@SuppressWarnings("rawtypes")
    protected void validateInputStreamData(Map isd) throws IllegalStateException {
        String message = null;
        if (isd != null) {
            if (isd.size() <= 3) {
                boolean type = isd.containsKey(INPUT_STREAM_CONTENT_TYPE);
                boolean length = isd.containsKey(INPUT_STREAM_CONTENT_DATA_LENGTH);
                boolean data = isd.containsKey(INPUT_STREAM_CONTENT_DATA);
                if (type && length && data) {
                    // valid.
                    return;
                } else {
                    message = "One of required values of InputStreamData is missing. type : " + type + " length : " + length + " data : " + data;
                }
            } else {
                message = "InputStreamData contains an unrecognized item.";
            }
        } else {
            message = "InputStreamData is null.";
        }
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
            logger.logp(Level.FINE, CLASS_NAME,"validateInputStreamData", message);
        throw new IllegalStateException(message);
    }
655634
public static byte[] bytes(InputStream in) throws IOException {
        if (in == null) {
            throw new IllegalArgumentException("input stream cannot be null");
        }
        ByteArrayOutputStream os = null;
        try {
            os = new ByteArrayOutputStream(1024);
            byte[] bytes = new byte[1024];
            int len;
            while ((len = in.read(bytes)) != -1) {
                os.write(bytes, 0, len);
            }
            return os.toByteArray();
        } finally {
            closeQuietly(os);
        }
    }
905014
@Nullable
  public static Map<String, String> parsePointer(@NotNull InputStream stream) throws IOException {
    byte[] buffer = new byte[Constants.POINTER_MAX_SIZE];
    int size = 0;
    while (size < buffer.length) {
      int len = stream.read(buffer, size, buffer.length - size);
      if (len <= 0) {
        return parsePointer(buffer, 0, size);
      }
      size += len;
    }
    return null;
  }
962106
public int readFrom(InputStream stream) throws IOException {
        int bytesRead = stream.read(buffer);
        if (bytesRead < 0) {
            bytesInBuffer = 0;
        } else {
            bytesInBuffer = bytesRead;
        }
        return bytesRead;
    }
376210
public static byte[] readLine(InputStream in) throws IOException {
		int BUFF_LENGTH = 256;
		byte[] buf = new byte[BUFF_LENGTH];

		int i = 0;
		int loops = 0;
		int ch = 0;

		while (true) {
			ch = in.read();
			if (ch < 0) {
				break;
			}
			loops++;

			// skip a leading LF's
			if (loops == 1 && ch == LF) {
				continue;
			}

			if (ch == CR || ch == LF) {
				break;
			}

			if (i >= buf.length) {
				byte[] oldBuf = buf;
				buf = new byte[oldBuf.length + BUFF_LENGTH];
				System.arraycopy(oldBuf, 0, buf, 0, oldBuf.length);
			}
			buf[i++] = (byte) ch;
		}

		if (ch == -1 && i == 0) {
			return null;
		}

		// skip a trailing LF if it exists
		if (ch == CR && in.available() >= 1 && in.markSupported()) {
			in.mark(1);
			ch = in.read();
			if (ch != LF) {
				in.reset();
			}
		}

		byte[] oldBuf = buf;
		buf = new byte[i];
		System.arraycopy(oldBuf, 0, buf, 0, i);

		return buf;
	}
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();
    }
986782
private static InputStream inputStreamFromAssets(GraphicFactory graphicFactory, String relativePathPrefix, String src) throws IOException {
        InputStream inputStream = null;
        try {
            inputStream = graphicFactory.platformSpecificSources(relativePathPrefix, src);
        } catch (IOException e) {
        }
        if (inputStream != null) {
            return inputStream;
        }
        return null;
    }