public class IOHelper extends Object
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE |
Constructor and Description |
---|
IOHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
close(Closeable closeable,
String name,
org.slf4j.Logger log)
Closes the given resource if it is available, logging any closing exceptions to the given log.
|
static void |
copy(InputStream is,
OutputStream os) |
static int |
copy(Reader input,
Writer output) |
static int |
copy(Reader input,
Writer output,
int bufferSize) |
static String |
readFully(BufferedReader reader)
Reads the entire reader into memory as a String
|
static String |
readFully(File file) |
static void |
write(File file,
byte[] data) |
static void |
write(File file,
byte[] data,
boolean append)
Writes the given data to the file; either in append mode or replace mode depending
the append flag
|
static void |
write(File file,
String text)
Writes the text to the given file, overwriting the previous file if it existed.
|
static void |
write(File file,
String text,
boolean append)
Writes the given text to the file; either in append mode or replace mode depending
the append flag
|
public static final int BUFFER_SIZE
public static String readFully(File file) throws IOException
IOException
public static String readFully(BufferedReader reader) throws IOException
IOException
public static void close(Closeable closeable, String name, org.slf4j.Logger log)
closeable
- the object to closename
- the name of the resourcelog
- the log to use when reporting closure warnings, will use this class's own Logger
if log == nullpublic static void write(File file, String text) throws IOException
IOException
public static void write(File file, byte[] data) throws IOException
IOException
public static void write(File file, String text, boolean append) throws IOException
IOException
public static void write(File file, byte[] data, boolean append) throws IOException
IOException
public static int copy(Reader input, Writer output) throws IOException
IOException
public static int copy(Reader input, Writer output, int bufferSize) throws IOException
IOException
public static void copy(InputStream is, OutputStream os) throws IOException
IOException
Copyright © 2018 JBoss by Red Hat. All rights reserved.