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

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

There is a newer version: 1.10.85
Show newest version
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