public class StringUtils extends Object
String.
try (Stream<String> stream = StringUtils.readLines(StringUtils.class, "text", "dummy.txt")) {
String[] result = stream.toArray(String[]::new);
assertEquals("abc", result[0]);
}
| Modifier and Type | Field and Description |
|---|---|
static String |
SEPARATOR
File separator (one character is required)
|
| Constructor and Description |
|---|
StringUtils()
With a charset UTF-8
|
StringUtils(@NotNull Charset charset) |
StringUtils(@NotNull Charset charset,
@NotNull Class<?> classOfLoader) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
buildResource(@Nullable Class<?> basePackage,
String... resourcePath)
Build a resource
|
static @NotNull String |
read(@NotNull Class<?> basePackage,
String... resourcePath)
Read a content of the resource encoded by UTF-8.
|
static @NotNull String |
read(@NotNull InputStream is)
Read a content of the resource encoded by UTF-8.
|
@NotNull String |
readBody(@NotNull Class<?> basePackage,
String... resourcePath)
Read a content of the resource encoded by UTF-8.
|
@NotNull String |
readBody(@NotNull InputStream is)
Read a content of the resource encoded by UTF-8.
|
@NotNull String |
readBody(String... resource)
Read a content of the resource encoded by UTF-8.
|
static @NotNull Stream<String> |
readLines(@Nullable Class<?> basePackage,
String... resourcePath)
Read a content of the resource encoded by UTF-8.
|
static @NotNull Stream<String> |
readLines(String... resourcePath)
Read a content of the resource encoded by UTF-8.
|
static @NotNull Stream<String> |
readLines(@NotNull URL url)
Read a closeable line stream of the URL.
|
@NotNull Stream<String> |
readRows(@Nullable Class<?> basePackage,
String... resourcePath)
Read a content of the resource encoded by UTF-8.
|
@NotNull Stream<String> |
readRows(@NotNull InputStream is)
Read a closeable line stream of the URL.
|
@NotNull Stream<String> |
readRows(@NotNull URL url)
Read a closeable line stream of the URL.
|
public static final String SEPARATOR
public StringUtils()
public StringUtils(@NotNull
@NotNull Charset charset)
@NotNull public @NotNull String readBody(@NotNull String... resource)
@NotNull public @NotNull String readBody(@NotNull @NotNull Class<?> basePackage, @NotNull String... resourcePath)
@NotNull public @NotNull String readBody(@NotNull @NotNull InputStream is)
@NotNull public @NotNull Stream<String> readRows(@Nullable @Nullable Class<?> basePackage, @NotNull String... resourcePath)
@NotNull public @NotNull Stream<String> readRows(@NotNull @NotNull URL url) throws IOException
IOException@NotNull public @NotNull Stream<String> readRows(@NotNull @NotNull InputStream is) throws IOException
IOExceptionprotected String buildResource(@Nullable @Nullable Class<?> basePackage, @NotNull String... resourcePath)
@NotNull public static @NotNull String read(@NotNull @NotNull Class<?> basePackage, @NotNull String... resourcePath)
@NotNull public static @NotNull String read(@NotNull @NotNull InputStream is)
@NotNull public static @NotNull Stream<String> readLines(@NotNull @NotNull URL url) throws IOException
IOException@NotNull public static @NotNull Stream<String> readLines(@Nullable @Nullable Class<?> basePackage, @NotNull String... resourcePath)
Copyright 2015, Pavel Ponec