public final class IOUtil extends Object
Modifier and Type | Method and Description |
---|---|
static void |
close(Closeable closeable) |
static Exception |
closeSilent(Closeable closeable) |
static Exception |
closeSilent(ServerSocket socket) |
static Exception |
closeSilent(Socket socket) |
static long |
copy(InputStream input,
OutputStream output) |
static long |
copy(InputStream input,
OutputStream output,
byte[] buffer) |
static long |
copy(InputStream input,
OutputStream output,
int bufferSize) |
static void |
copyFile(File source,
File target) |
static void |
copyTree(File source,
File target) |
static boolean |
deleteBestEffort(File file) |
static boolean |
deleteBestEffort(File file,
boolean deleteOnExit) |
static Serializable |
deserialize(byte[] bytes) |
static Serializable |
deserialize(byte[] bytes,
ClassLoader classLoader) |
static String |
encodeFileName(String path) |
static byte[] |
getSHA1(InputStream contents) |
static byte[] |
getSHA1(String contents) |
static boolean |
isSerializeable(Object object) |
static List<File> |
listBreadthFirst(File file) |
static List<File> |
listDepthFirst(File file) |
static void |
mkdirs(File folder) |
static FileInputStream |
openInputStream(File file) |
static FileOutputStream |
openOutputStream(File file) |
static byte[] |
readFile(File file) |
static List<String> |
readLines(File file,
String charsetName) |
static String |
readUTF8(File file) |
static String |
readXML(InputStream inputStream) |
static byte[] |
serialize(Serializable object) |
static void |
writeFile(File file,
byte[] bytes) |
static void |
writeLines(File file,
String charsetName,
List<String> lines) |
static void |
writeUTF8(File file,
String contents) |
public static boolean isSerializeable(Object object)
public static byte[] serialize(Serializable object)
public static Serializable deserialize(byte[] bytes)
public static Serializable deserialize(byte[] bytes, ClassLoader classLoader)
public static byte[] getSHA1(String contents) throws NoSuchAlgorithmException, IOException
NoSuchAlgorithmException
IOException
public static byte[] getSHA1(InputStream contents) throws NoSuchAlgorithmException, IOException
NoSuchAlgorithmException
IOException
public static FileInputStream openInputStream(File file) throws IORuntimeException
IORuntimeException
public static FileOutputStream openOutputStream(File file) throws IORuntimeException
IORuntimeException
public static Exception closeSilent(ServerSocket socket)
public static void close(Closeable closeable) throws IORuntimeException
IORuntimeException
public static void mkdirs(File folder) throws IORuntimeException
IORuntimeException
public static boolean deleteBestEffort(File file)
public static boolean deleteBestEffort(File file, boolean deleteOnExit)
public static long copy(InputStream input, OutputStream output, byte[] buffer) throws IORuntimeException
IORuntimeException
public static long copy(InputStream input, OutputStream output, int bufferSize) throws IORuntimeException
IORuntimeException
public static long copy(InputStream input, OutputStream output) throws IORuntimeException
IORuntimeException
public static void copyTree(File source, File target) throws IORuntimeException
IORuntimeException
public static void copyFile(File source, File target) throws IORuntimeException
IORuntimeException
public static byte[] readFile(File file) throws IORuntimeException
IORuntimeException
public static void writeFile(File file, byte[] bytes) throws IORuntimeException
IORuntimeException
public static void writeUTF8(File file, String contents) throws Exception
Exception
public static String readXML(InputStream inputStream) throws Exception
Exception
Copyright (c) 2014 Eike Stepper (Loehne, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v2.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v20.html