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 void |
copy(Resource from,
Resource to) |
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
IllegalStateExceptionpublic static Writer getWriter(OutputStream outputStream, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static Writer getWriter(OutputStream outputStream, String encoding, boolean insertBom) throws IllegalStateException
IllegalStateExceptionpublic static Writer getWriter(File file, String encoding, boolean append, boolean insertBom) throws IllegalStateException
IllegalStateExceptionpublic static Writer getWriter(File file, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static Reader getReader(InputStream inputStream, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static Reader getReader(File file, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static String readInputStreamAsString(InputStream inputStream, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static String readFileAsString(File file, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static String readAsString(Reader reader) throws IllegalStateException
IllegalStateExceptionpublic static void safeClose(Object... objects)
public static BufferedWriter getBufferedWriter(File file, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static BufferedReader getBufferedReader(File file, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static BufferedReader getBufferedReader(InputStream inputStream, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static Reader getReader(File file) throws IllegalStateException
IllegalStateExceptionpublic static String readFileAsString(File file) throws IllegalStateException
IllegalStateExceptionpublic static BufferedWriter getBufferedWriter(File file) throws IllegalStateException
IllegalStateExceptionpublic static Writer getWriter(File file) throws IllegalStateException
IllegalStateExceptionpublic static void writeString(OutputStream outputStream, String string) throws IllegalStateException
IllegalStateExceptionpublic static void writeString(OutputStream outputStream, String string, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static void writeString(Writer writer, String string) throws IllegalStateException
IllegalStateExceptionpublic static void writeString(Writer writer, String string, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static void writeStringAsFile(File file, String string) throws IllegalStateException
IllegalStateExceptionpublic static void writeStringAsFile(File file, String string, String encoding) throws IllegalStateException
IllegalStateExceptionpublic static BufferedReader getBufferedReader(File file) throws IllegalStateException
IllegalStateExceptionpublic static void copy(Reader reader, Writer writer) throws IllegalStateException
IllegalStateExceptionpublic static BufferedReader getBufferedReader(Reader reader)
public static void copy(InputStream fromStream, OutputStream toStream) throws IllegalStateException
IllegalStateExceptionpublic static void copy(Resource from, Resource to) throws IllegalStateException
IllegalStateExceptionpublic static void copy(File from, File to) throws IllegalStateException
IllegalStateExceptionpublic static OutputStream getOutputStream(File file) throws IllegalStateException
IllegalStateExceptionpublic static OutputStream getOutputStream(File file, boolean append)
public static InputStream getInputStream(File file) throws IllegalStateException
IllegalStateExceptionpublic static byte[] readAsBytes(InputStream inputStream)
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.