@Override public int read(byte[] b, int off, int len) throws IOException { sleepUntilReadWouldBeNonBlocking(); return super.read(b, off, len); }
static public StreamableOutput standardOutput() { OutputStream os = new CloseGuardedOutputStream(System.out); return new StreamableOutput(os, "<stdout>", null, null); }
public Which command(Path command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = command; return this; }
static public LineOutputStream<BufferingProcessor> buffering(Charset charset) { return new LineOutputStream<>(new BufferingProcessor(), charset); }
static public LineOutputStream<LastLineProcessor> lastLine(Charset charset) { return new LineOutputStream<>(new LastLineProcessor(), charset); }
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 closeQuietly(Closeable stream) { try { close(stream); } catch (BlazeException e) { // do nothing } }
/** * Puts data to the ring buffer. * * <p> * Convenience method for: <code>write(buf, 0, buf.length)</code> * @param buf * @return */ public int put(byte[] buf) { return put(buf, 0, buf.length); }
/** * Gets data from the ring buffer. * * <p> * Convenience method for: <code>read(buf, 0, buf.length)</code> */ public int get(byte[] buf) { return get(buf, 0, buf.length); }
@Override public int read() throws IOException { sleepUntilReadWouldBeNonBlocking(); return super.read(); }
static public StreamableOutput standardError() { OutputStream os = new CloseGuardedOutputStream(System.err); return new StreamableOutput(os, "<stderr>", null, null); }
public NameValue(N name, V value) { ObjectHelper.requireNonNull(name, "name cannot be null"); this.name = name; this.value = value; }
@Override public int read(byte[] b) throws IOException { sleepUntilReadWouldBeNonBlocking(); return super.read(b); }
static public StreamableOutput standardOutput() { OutputStream os = new CloseGuardedOutputStream(System.out); return new StreamableOutput(os, "<stdout>", null, null); }
@Override public int read(byte[] b) throws IOException { sleepUntilReadWouldBeNonBlocking(); return super.read(b); }
static public StreamableOutput standardError() { OutputStream os = new CloseGuardedOutputStream(System.err); return new StreamableOutput(os, "<stderr>", null, null); }
@Override public int read(byte[] b, int off, int len) throws IOException { sleepUntilReadWouldBeNonBlocking(); return super.read(b, off, len); }
@Override public int read() throws IOException { sleepUntilReadWouldBeNonBlocking(); return super.read(); }