Move package-private method.

This commit is contained in:
Gary Gregory 2022-09-12 12:50:16 -07:00
parent d48bc1e6cf
commit b5b3cca98b
2 changed files with 15 additions and 15 deletions

View File

@ -70,19 +70,6 @@ import java.util.stream.Stream;
*/
public final class CSVPrinter implements Flushable, Closeable {
/**
* Throws the given throwable.
*
* @param <T> The throwable cast type.
* @param throwable The throwable to rethrow.
* @return nothing because we throw.
* @throws T Always thrown.
*/
@SuppressWarnings("unchecked")
private static <T extends Throwable> RuntimeException rethrow(final Throwable throwable) throws T {
throw (T) throwable;
}
/** The place that the values get written. */
private final Appendable appendable;
@ -313,7 +300,7 @@ public final class CSVPrinter implements Flushable, Closeable {
try {
print(t);
} catch (final IOException e) {
throw rethrow(e);
throw IOUtils.rethrow(e);
}
});
println();
@ -502,7 +489,7 @@ public final class CSVPrinter implements Flushable, Closeable {
try {
printRecordObject(t);
} catch (final IOException e) {
throw rethrow(e);
throw IOUtils.rethrow(e);
}
});
}

View File

@ -131,4 +131,17 @@ final class IOUtils {
// Noop
}
/**
* Throws the given throwable.
*
* @param <T> The throwable cast type.
* @param throwable The throwable to rethrow.
* @return nothing because we throw.
* @throws T Always thrown.
*/
@SuppressWarnings("unchecked")
static <T extends Throwable> RuntimeException rethrow(final Throwable throwable) throws T {
throw (T) throwable;
}
}