static public StreamableInput standardInput() { // zt-exec will hang forever if you don't explicitly use System.in :-( //InputStream is = new CloseGuardedInputStream(System.in); return new StreamableInput(System.in, "<stdin>", null, null); }
static public void copy(StreamableInput input, StreamableOutput output, int bufferSize) throws IOException { copy(input.stream(), output.stream(), bufferSize); }
static public void copy(StreamableInput input, StreamableOutput output, int bufferSize) throws IOException { copy(input.stream(), output.stream(), bufferSize); }
final InputStream is = (pipeInput != null ? new InterruptibleInputStream(pipeInput.stream()) : null); final OutputStream os = (pipeOutput != null ? pipeOutput.stream() : new NullOutputStream()); final OutputStream es = (pipeErrorToOutput ? os : (pipeError != null ? pipeError.stream() : new NullOutputStream()));
static public StreamableInput standardInput() { // zt-exec will hang forever if you don't explicitly use System.in :-( //InputStream is = new CloseGuardedInputStream(System.in); return new StreamableInput(System.in, "<stdin>", null, null); }
final InputStream is = (pipeInput != null ? pipeInput.stream() : null); final OutputStream os = (pipeOutput != null ? pipeOutput.stream() : null); final OutputStream es = (pipeErrorToOutput ? os : (pipeError != null ? pipeError.stream() : null));
static public StreamableInput input(InputStream stream, String name) { Objects.requireNonNull(stream, "stream cannot be null"); return new StreamableInput(stream, (name != null ? name : "<stream>"), null, null); }
final InputStream is = (pipeInput != null ? pipeInput.stream() : null); final OutputStream os = (pipeOutput != null ? pipeOutput.stream() : null); final OutputStream es = (pipeErrorToOutput ? os : (pipeError != null ? pipeError.stream() : null));
static public StreamableInput input(InputStream stream, String name) { Objects.requireNonNull(stream, "stream cannot be null"); return new StreamableInput(stream, (name != null ? name : "<stream>"), null, null); }
/** * Creates an input stream of text as specified bytes. * @param text The text which will be treated as specified bytes * @param charset The charset to use when creating the input stream bytes * @return The new input */ static public StreamableInput input(String text, Charset charset) { Objects.requireNonNull(text, "text cannot be null"); Objects.requireNonNull(charset, "charset cannot be null"); byte[] bytes = text.getBytes(charset); InputStream stream = new ByteArrayInputStream(bytes); return new StreamableInput(stream, "<text(" + bytes.length + " bytes>", null, (long)bytes.length); }
/** * Creates an input stream of text as specified bytes. * @param text The text which will be treated as specified bytes * @param charset The charset to use when creating the input stream bytes * @return The new input */ static public StreamableInput input(String text, Charset charset) { Objects.requireNonNull(text, "text cannot be null"); Objects.requireNonNull(charset, "charset cannot be null"); byte[] bytes = text.getBytes(charset); InputStream stream = new ByteArrayInputStream(bytes); return new StreamableInput(stream, "<text(" + bytes.length + " bytes>", null, (long)bytes.length); }
static public StreamableInput input(Path path) { Objects.requireNonNull(path, "path cannot be null"); if (!Files.exists(path)) { throw new FileNotFoundException("Path " + path + " not found"); } long size; try { size = Files.size(path); } catch (IOException e) { throw new BlazeException(e.getMessage(), e); } return new StreamableInput(new DeferredFileInputStream(path), path.getFileName().toString(), path, size); }
static public StreamableInput input(Path path) { Objects.requireNonNull(path, "path cannot be null"); if (!Files.exists(path)) { throw new FileNotFoundException("Path " + path + " not found"); } long size; try { size = Files.size(path); } catch (IOException e) { throw new BlazeException(e.getMessage(), e); } return new StreamableInput(new DeferredFileInputStream(path), path.getFileName().toString(), path, size); }
static public StreamableInput nullInput() { return new StreamableInput(new NullInputStream(0, true, true), "<null>", null, null); }
static public StreamableInput nullInput() { return new StreamableInput(new NullInputStream(0, true, true), "<null>", null, null); }