/** Copy input to output and close both the input and output streams before returning */ public static long copyAndCloseBoth(InputStream input, OutputStream output) throws IOException { try (InputStream inputStream = input) { return copyAndCloseOutput(inputStream, output); } }
/** Read the lines (as UTF8) of the resource file fn from the package of the given class into a (unmodifiable) list of strings * @throws IOException */ public static List<String> readResource(Class<?> clazz, String fn) throws IOException { try (final Reader reader = asReaderUTF8Lenient(getResourceAsStream(clazz, fn))) { return readToList(reader); } }
/** Copy input to output and close the output stream before returning */ public static long copyAndCloseOutput(InputStream input, OutputStream output) throws IOException { try (OutputStream outputStream = output) { return copy(input, outputStream); } }
private ProfilingTimer(Log log, ByteArrayOutputStream serializationOutput, String processName, Object... args) { this.log = log; this.serializationOutput = serializationOutput; start(processName, args); }
/** @see {@link Strings#formatEnum(Enum)} */ public static String formatEnum(Enum<?> enumValue) { return Strings.formatEnum(enumValue); } }
private ProfilingTimerNode(String taskName, ProfilingTimerNode parent, Log log) { this.taskName = taskName; if (parent != null) { parent.addChild(this); } this.log = log; }
/** * Join the toString of each object element into a single string, with * each element separated by the given sep (which can be empty). */ public static String joinObjects(String sep, Iterable<?> l) { return sepList(sep, l, -1); }
/** Read the lines (as UTF8) of the resource file fn from the package of the given class into a (unmodifiable) list of strings * @throws IOException */ public static List<String> readResource(Class<?> clazz, String fn) throws IOException { try (final Reader reader = asReaderUTF8Lenient(getResourceAsStream(clazz, fn))) { return readToList(reader); } }
/** Copy input to output and close both the input and output streams before returning */ public static long copyAndCloseBoth(InputStream input, OutputStream output) throws IOException { try (InputStream inputStream = input) { return copyAndCloseOutput(inputStream, output); } }
/** Copy input to output and close the output stream before returning */ public static long copyAndCloseOutput(InputStream input, OutputStream output) throws IOException { try (OutputStream outputStream = output) { return copy(input, outputStream); } }
private ProfilingTimer(Log log, ByteArrayOutputStream serializationOutput, String processName, Object... args) { this.log = log; this.serializationOutput = serializationOutput; start(processName, args); }
/** @see {@link Strings#formatEnum(Enum)} */ public static String formatEnum(Enum<?> enumValue) { return Strings.formatEnum(enumValue); } }