@Nonnull
	public static byte[] toByteArray(InputStream in, byte[] buf) throws IOException {
		int length;
		try {
			length = in.available();
		} catch (IOException ignored) {
			// Cannot get length from stream, fallback to default.
			length = BUFFER_SIZE;
		}
		OptimizedByteArrayOutputStream baos = new OptimizedByteArrayOutputStream(length);
		copy(in, baos, buf);
		return baos.getBytes();
	}
Returns content of {@link InputStream} as a byte array.

@param in
		Stream to transfer content from.
@param buf
		Buffer that is used to hold data.

@return content of {@link InputStream}.

@throws IOException
		When any I/O error occurs.
recaf-core/src/main/java/software/coley/recaf/util/IOUtil.java