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

com.pdd.pop.sdk.common.util.IOSupport Maven / Gradle / Ivy

package com.pdd.pop.sdk.common.util;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;

public abstract class IOSupport {
    
    public static String readString(InputStream inputStream) {
        try {
            byte[] bytes =  new byte[inputStream.available()];
            inputStream.read(bytes);
            return new String(bytes);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
    
    public static void closeQuietly(final Closeable closeable) {
        try {
            if (closeable != null) {
                closeable.close();
            }
        } catch (final IOException ioe) {
            // ignore
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy