Package com.alibaba.nacos.common.utils
Class IoUtils
- java.lang.Object
-
- com.alibaba.nacos.common.utils.IoUtils
-
public class IoUtils extends Object
IO related tool methods- Author:
- nacos
-
-
Constructor Summary
Constructors Constructor Description IoUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcleanDirectory(File directory)清理目录下的内容static voidcloseQuietly(Closeable closeable)static voidcloseQuietly(InputStream input)static voidcloseQuietly(OutputStream output)static voidcloseQuietly(HttpURLConnection connection)static longcopy(InputStream input, OutputStream output)static longcopy(Reader input, Writer output)static voidcopyFile(String source, String target)static voiddelete(File fileOrDir)static booleanisGzipStream(byte[] bytes)static List<String>readLines(Reader input)static StringtoString(InputStream input, String encoding)static StringtoString(Reader reader)static byte[]tryDecompress(byte[] raw)static byte[]tryDecompress(InputStream raw)static voidwriteStringToFile(File file, String data, String encoding)
-
-
-
Method Detail
-
tryDecompress
public static byte[] tryDecompress(InputStream raw) throws Exception
- Throws:
Exception
-
writeStringToFile
public static void writeStringToFile(File file, String data, String encoding) throws IOException
- Throws:
IOException
-
readLines
public static List<String> readLines(Reader input) throws IOException
- Throws:
IOException
-
toString
public static String toString(InputStream input, String encoding) throws IOException
- Throws:
IOException
-
toString
public static String toString(Reader reader) throws IOException
- Throws:
IOException
-
copy
public static long copy(Reader input, Writer output) throws IOException
- Throws:
IOException
-
delete
public static void delete(File fileOrDir) throws IOException
- Throws:
IOException
-
cleanDirectory
public static void cleanDirectory(File directory) throws IOException
清理目录下的内容- Throws:
IOException
-
copy
public static long copy(InputStream input, OutputStream output) throws IOException
- Throws:
IOException
-
copyFile
public static void copyFile(String source, String target) throws IOException
- Throws:
IOException
-
isGzipStream
public static boolean isGzipStream(byte[] bytes)
-
closeQuietly
public static void closeQuietly(HttpURLConnection connection)
-
closeQuietly
public static void closeQuietly(InputStream input)
-
closeQuietly
public static void closeQuietly(OutputStream output)
-
closeQuietly
public static void closeQuietly(Closeable closeable)
-
-