public final class IOUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
deleteReport(java.io.File file) |
static void |
safeClose(java.io.Closeable closeable)
Closes a Closeable.
|
static java.lang.String |
streamToString(java.io.InputStream input)
Reads an InputStream into a string
|
static java.lang.String |
streamToString(java.io.InputStream input,
int limit)
Reads an InputStream into a string
|
static java.lang.String |
streamToString(java.io.InputStream input,
com.android.internal.util.Predicate<java.lang.String> filter)
Reads an InputStream into a string
|
static java.lang.String |
streamToString(java.io.InputStream input,
com.android.internal.util.Predicate<java.lang.String> filter,
int limit)
Reads an InputStream into a string
|
static java.lang.String |
streamToStringNonBlockingRead(java.io.InputStream input,
com.android.internal.util.Predicate<java.lang.String> filter,
int limit)
Reads an InputStream into a string without blocking the current thread.
|
static void |
writeStringToFile(java.io.File file,
java.lang.String content) |
public static void safeClose(@Nullable java.io.Closeable closeable)
closeable
- Closeable to close. If closeable is null then method just returns.@NonNull public static java.lang.String streamToString(@NonNull java.io.InputStream input) throws java.io.IOException
input
- InputStream to read.java.io.IOException
- if the InputStream could not be read.@NonNull public static java.lang.String streamToString(@NonNull java.io.InputStream input, com.android.internal.util.Predicate<java.lang.String> filter) throws java.io.IOException
input
- InputStream to read.filter
- should return false for lines which should be excludedjava.io.IOException
- if the InputStream could not be read.@NonNull public static java.lang.String streamToString(@NonNull java.io.InputStream input, int limit) throws java.io.IOException
input
- InputStream to read.limit
- the maximum number of lines to read (the last x lines are kept)java.io.IOException
- if the InputStream could not be read.@NonNull public static java.lang.String streamToString(@NonNull java.io.InputStream input, com.android.internal.util.Predicate<java.lang.String> filter, int limit) throws java.io.IOException
input
- InputStream to read.filter
- Predicate that should return false for lines which should be excluded.limit
- the maximum number of lines to read (the last x lines are kept)java.io.IOException
- if the InputStream could not be read.@NonNull public static java.lang.String streamToStringNonBlockingRead(@NonNull java.io.InputStream input, com.android.internal.util.Predicate<java.lang.String> filter, int limit) throws java.io.IOException
input
- InputStream to read.filter
- Predicate that should return false for lines which should be excluded.limit
- the maximum number of lines to read (the last x lines are kept).java.io.IOException
- if the InputStream could not be read.public static void deleteReport(@NonNull java.io.File file)
public static void writeStringToFile(@NonNull java.io.File file, @NonNull java.lang.String content) throws java.io.IOException
java.io.IOException