All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.snowdrop.istio.util.Utils Maven / Gradle / Ivy

There is a newer version: 1.7.7.1
Show newest version
/**
 * Copyright 2018 Red Hat, Inc. and/or its affiliates.
 * 

* Licensed under the Eclipse Public License version 1.0, available at * http://www.eclipse.org/legal/epl-v10.html */ package me.snowdrop.istio.util; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; /** * @author Christophe Laprun */ public class Utils { public static String writeStreamToString(InputStream inputStream) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length; try { while ((length = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, length); } return outputStream.toString(); } catch (IOException e) { throw new RuntimeException("Unable to read InputStream.", e); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy