public class OutputStream
extends Object
GDK enhancements for OutputStream.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Writer |
leftShift(Object value)Overloads the leftShift operator to provide an append mechanism to add values to a stream. |
|
public OutputStream |
leftShift(InputStream in)Pipe an InputStream into an OutputStream for efficient stream copying. |
|
public OutputStream |
leftShift(byte[] value)Overloads the leftShift operator to provide an append mechanism to add bytes to a stream. |
|
public ObjectOutputStream |
newObjectOutputStream()Create an object output stream for this output stream. |
|
public PrintWriter |
newPrintWriter()Create a new PrintWriter for this OutputStream. |
|
public Writer |
newWriter()Creates a writer for this stream. |
|
public Writer |
newWriter(String charset)Creates a writer for this stream using the given charset. |
|
public void |
setBytes(byte[] bytes)Write the byte[] to the output stream. |
<T> |
public T |
withObjectOutputStream(Closure<T> closure)Create a new ObjectOutputStream for this output stream and then pass it to the closure. |
<T> |
public T |
withPrintWriter(Closure<T> closure)Create a new PrintWriter for this OutputStream. |
<T> |
public T |
withWriter(Closure<T> closure)Creates a writer from this stream, passing it to the given closure. |
<T> |
public T |
withWriter(String charset, Closure<T> closure)Creates a writer from this stream, passing it to the given closure. |
| Methods inherited from class | Name |
|---|---|
class Object |
addShutdownHook, any, any, asBoolean, asType, collect, collect, collect, dump, each, eachMatch, eachMatch, eachWithIndex, every, every, find, find, findAll, findAll, findIndexOf, findIndexOf, findIndexValues, findIndexValues, findLastIndexOf, findLastIndexOf, findResult, findResult, findResult, findResult, getAt, getMetaClass, getMetaPropertyValues, getProperties, grep, grep, hasProperty, identity, inject, inject, inspect, invokeMethod, is, isCase, isNotCase, iterator, metaClass, print, print, printf, printf, println, println, println, putAt, respondsTo, respondsTo, setMetaClass, sleep, sleep, split, sprintf, sprintf, stream, tap, toString, use, use, use, with, with, withCloseable, withCloseable, withMethodClosure, withStream, withStream, withTraits |
Overloads the leftShift operator to provide an append mechanism to add values to a stream.
value - a value to appendPipe an InputStream into an OutputStream for efficient stream copying.
in - stream to read fromOverloads the leftShift operator to provide an append mechanism to add bytes to a stream.
value - a value to appendCreate an object output stream for this output stream.
Create a new PrintWriter for this OutputStream.
Creates a writer for this stream.
Creates a writer for this stream using the given charset.
charset - the charset usedWrite the byte[] to the output stream. The stream is closed before this method returns.
bytes - the byte[] to write to the output streamCreate a new ObjectOutputStream for this output stream and then pass it to the closure. This method ensures the stream is closed after the closure returns.
closure - a closureCreate a new PrintWriter for this OutputStream. The writer is passed to the closure, and will be closed before this method returns.
closure - the closure to invoke with the PrintWriterCreates a writer from this stream, passing it to the given closure. This method ensures the stream is closed after the closure returns.
closure - the closure that the writer is passed intoCreates a writer from this stream, passing it to the given closure. This method ensures the stream is closed after the closure returns.
charset - the charset usedclosure - the closure that the writer is passed into