public final class FileHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ENCODING |
static String |
ISO_8859_1_ENCODING |
static String |
US_ASCII_ENCODING |
static String |
UTF_16_ENCODING |
static String |
UTF_8_ENCODING |
Modifier and Type | Method and Description |
---|---|
static void |
copy(File from,
File to) |
static void |
copy(InputStream fromStream,
OutputStream toStream) |
static void |
copy(Reader reader,
Writer writer) |
static File |
createTempFile(String prefix,
String suffix) |
static BufferedReader |
getBufferedReader(File file) |
static BufferedReader |
getBufferedReader(File file,
String encoding) |
static BufferedReader |
getBufferedReader(InputStream inputStream,
String encoding) |
static BufferedReader |
getBufferedReader(Reader reader) |
static BufferedWriter |
getBufferedWriter(File file) |
static BufferedWriter |
getBufferedWriter(File file,
String encoding) |
static InputStream |
getInputStream(File file) |
static OutputStream |
getOutputStream(File file) |
static OutputStream |
getOutputStream(File file,
boolean append) |
static Reader |
getReader(File file) |
static Reader |
getReader(File file,
String encoding) |
static Reader |
getReader(InputStream inputStream,
String encoding) |
static File |
getTempDir() |
static Writer |
getWriter(File file) |
static Writer |
getWriter(File file,
String encoding) |
static Writer |
getWriter(File file,
String encoding,
boolean append) |
static Writer |
getWriter(File file,
String encoding,
boolean append,
boolean insertBom) |
static Writer |
getWriter(OutputStream outputStream,
String encoding) |
static Writer |
getWriter(OutputStream outputStream,
String encoding,
boolean insertBom) |
static byte[] |
readAsBytes(InputStream inputStream) |
static String |
readAsString(Reader reader) |
static String |
readFileAsString(File file) |
static String |
readFileAsString(File file,
String encoding) |
static String |
readInputStreamAsString(InputStream inputStream,
String encoding) |
static void |
safeClose(Object... objects) |
static void |
writeString(OutputStream outputStream,
String string) |
static void |
writeString(OutputStream outputStream,
String string,
String encoding) |
static void |
writeString(Writer writer,
String string) |
static void |
writeString(Writer writer,
String string,
String encoding) |
static void |
writeStringAsFile(File file,
String string) |
static void |
writeStringAsFile(File file,
String string,
String encoding) |
public static final String UTF_8_ENCODING
public static final String UTF_16_ENCODING
public static final String US_ASCII_ENCODING
public static final String ISO_8859_1_ENCODING
public static final String DEFAULT_ENCODING
public static File getTempDir()
public static Writer getWriter(File file, String encoding, boolean append) throws IllegalStateException
IllegalStateException
public static Writer getWriter(OutputStream outputStream, String encoding) throws IllegalStateException
IllegalStateException
public static Writer getWriter(OutputStream outputStream, String encoding, boolean insertBom) throws IllegalStateException
IllegalStateException
public static Writer getWriter(File file, String encoding, boolean append, boolean insertBom) throws IllegalStateException
IllegalStateException
public static Writer getWriter(File file, String encoding) throws IllegalStateException
IllegalStateException
public static Reader getReader(InputStream inputStream, String encoding) throws IllegalStateException
IllegalStateException
public static Reader getReader(File file, String encoding) throws IllegalStateException
IllegalStateException
public static String readInputStreamAsString(InputStream inputStream, String encoding) throws IllegalStateException
IllegalStateException
public static String readFileAsString(File file, String encoding) throws IllegalStateException
IllegalStateException
public static String readAsString(Reader reader) throws IllegalStateException
IllegalStateException
public static void safeClose(Object... objects)
public static BufferedWriter getBufferedWriter(File file, String encoding) throws IllegalStateException
IllegalStateException
public static BufferedReader getBufferedReader(File file, String encoding) throws IllegalStateException
IllegalStateException
public static BufferedReader getBufferedReader(InputStream inputStream, String encoding) throws IllegalStateException
IllegalStateException
public static Reader getReader(File file) throws IllegalStateException
IllegalStateException
public static String readFileAsString(File file) throws IllegalStateException
IllegalStateException
public static BufferedWriter getBufferedWriter(File file) throws IllegalStateException
IllegalStateException
public static Writer getWriter(File file) throws IllegalStateException
IllegalStateException
public static void writeString(OutputStream outputStream, String string) throws IllegalStateException
IllegalStateException
public static void writeString(OutputStream outputStream, String string, String encoding) throws IllegalStateException
IllegalStateException
public static void writeString(Writer writer, String string) throws IllegalStateException
IllegalStateException
public static void writeString(Writer writer, String string, String encoding) throws IllegalStateException
IllegalStateException
public static void writeStringAsFile(File file, String string) throws IllegalStateException
IllegalStateException
public static void writeStringAsFile(File file, String string, String encoding) throws IllegalStateException
IllegalStateException
public static BufferedReader getBufferedReader(File file) throws IllegalStateException
IllegalStateException
public static void copy(Reader reader, Writer writer) throws IllegalStateException
IllegalStateException
public static BufferedReader getBufferedReader(Reader reader)
public static void copy(InputStream fromStream, OutputStream toStream) throws IllegalStateException
IllegalStateException
public static void copy(File from, File to) throws IllegalStateException
IllegalStateException
public static OutputStream getOutputStream(File file) throws IllegalStateException
IllegalStateException
public static OutputStream getOutputStream(File file, boolean append)
public static InputStream getInputStream(File file) throws IllegalStateException
IllegalStateException
public static byte[] readAsBytes(InputStream inputStream)
Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.