mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
Formatting
This commit is contained in:
@@ -2967,12 +2967,15 @@ public class GHRepository extends GHObject {
|
||||
/**
|
||||
* Streams a zip archive of the repository, optionally at a given <code>ref</code>.
|
||||
*
|
||||
* @param <T>
|
||||
* the type of result
|
||||
* @param streamFunction
|
||||
* The {@link InputStreamFunction} that will process the stream
|
||||
* @param ref
|
||||
* if <code>null</code> the repository's default branch, usually <code>master</code>,
|
||||
* @throws IOException
|
||||
* The IO exception.
|
||||
* @return the result of reading the stream.
|
||||
*/
|
||||
public <T> T readZip(InputStreamFunction<T> streamFunction, String ref) throws IOException {
|
||||
return downloadArchive("zip", ref, streamFunction);
|
||||
@@ -2981,19 +2984,23 @@ public class GHRepository extends GHObject {
|
||||
/**
|
||||
* Streams a tar archive of the repository, optionally at a given <code>ref</code>.
|
||||
*
|
||||
* @param <T>
|
||||
* the type of result
|
||||
* @param streamFunction
|
||||
* The {@link InputStreamFunction} that will process the stream
|
||||
* @param ref
|
||||
* if <code>null</code> the repository's default branch, usually <code>master</code>,
|
||||
* @throws IOException
|
||||
* The IO exception.
|
||||
* @return the result of reading the stream.
|
||||
*/
|
||||
public <T> T readTar(InputStreamFunction<T> streamFunction, String ref) throws IOException {
|
||||
return downloadArchive("tar", ref, streamFunction);
|
||||
}
|
||||
|
||||
private <T> T downloadArchive(@Nonnull String type, @CheckForNull String ref, @Nonnull InputStreamFunction<T> streamFunction)
|
||||
throws IOException {
|
||||
private <T> T downloadArchive(@Nonnull String type,
|
||||
@CheckForNull String ref,
|
||||
@Nonnull InputStreamFunction<T> streamFunction) throws IOException {
|
||||
requireNonNull(streamFunction, "Sink must not be null");
|
||||
String tailUrl = getApiTailUrl(type + "ball");
|
||||
if (ref != null) {
|
||||
|
||||
@@ -2,8 +2,24 @@ package org.kohsuke.github.function;
|
||||
|
||||
/**
|
||||
* A functional interface, equivalent to {@link java.util.function.Function} but that allows throwing {@link Throwable}
|
||||
*
|
||||
* @param <T>
|
||||
* the type of input
|
||||
* @param <R>
|
||||
* the type of output
|
||||
* @param <E>
|
||||
* the type of error
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface FunctionThrows<T, R, E extends Throwable> {
|
||||
/**
|
||||
* Apply r.
|
||||
*
|
||||
* @param input
|
||||
* the input
|
||||
* @return the r
|
||||
* @throws E
|
||||
* the e
|
||||
*/
|
||||
R apply(T input) throws E;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.io.InputStream;
|
||||
/**
|
||||
* A functional interface, equivalent to {@link java.util.function.Function} but that allows throwing {@link Throwable}
|
||||
*
|
||||
* @param <R>
|
||||
* the type to of object to be returned
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface InputStreamFunction<R> extends FunctionThrows<InputStream, R, IOException> {
|
||||
|
||||
Reference in New Issue
Block a user