| 
 | Groovy JDK | |||||||||
| Method Summary | |
|---|---|
| void | eachByte(Closure closure)Traverse through each byte of the specified stream. | 
| void | eachByte(int bufferLen, Closure closure)Traverse through each the specified stream reading bytes into a buffer and calling the 2 parameter closure with this buffer and the number of bytes. | 
| Object | eachLine(String charset, Closure closure)Iterates through this stream reading with the provided charset, passing each line to the given 1 or 2 arg closure. | 
| Object | eachLine(String charset, int firstLine, Closure closure)Iterates through this stream reading with the provided charset, passing each line to the given 1 or 2 arg closure. | 
| Object | eachLine(Closure closure)Iterates through this stream, passing each line to the given 1 or 2 arg closure. | 
| Object | eachLine(int firstLine, Closure closure)Iterates through this stream, passing each line to the given 1 or 2 arg closure. | 
| Writable | filterLine(Closure predicate)Filter lines from an input stream using a closure predicate. | 
| Writable | filterLine(String charset, Closure predicate)Filter lines from an input stream using a closure predicate. | 
| void | filterLine(Writer writer, Closure predicate)Uses a closure to filter lines from this InputStream and pass them to the given writer. | 
| void | filterLine(Writer writer, String charset, Closure predicate)Uses a closure to filter lines from this InputStream and pass them to the given writer. | 
| byte[] | getBytes()Read the content of this InputStream and return it as a byte[]. | 
| String | getText()Read the content of this InputStream and return it as a String. | 
| String | getText(String charset)Read the content of this InputStream using specified charset and return it as a String. | 
| Iterator | iterator()Standard iterator for a input stream which iterates through the stream content in a byte-based fashion. | 
| ObjectInputStream | newObjectInputStream()Create an object input stream for this input stream. | 
| ObjectInputStream | newObjectInputStream(ClassLoader classLoader)Create an object input stream for this input stream using the given class loader. | 
| BufferedReader | newReader()Creates a reader for this input stream. | 
| BufferedReader | newReader(String charset)Creates a reader for this input stream, using the specified charset as the encoding. | 
| List | readLines()Reads the stream into a list, with one element for each line. | 
| List | readLines(String charset)Reads the stream into a list, with one element for each line. | 
| Object | splitEachLine(String regex, String charset, Closure closure)Iterates through the given InputStream line by line using the specified encoding, splitting each line using the given separator. | 
| Object | splitEachLine(Pattern pattern, String charset, Closure closure)Iterates through the given InputStream line by line using the specified encoding, splitting each line using the given separator Pattern. | 
| Object | splitEachLine(String regex, Closure closure)Iterates through the given InputStream line by line, splitting each line using the given separator. | 
| Object | splitEachLine(Pattern pattern, Closure closure)Iterates through the given InputStream line by line, splitting each line using the given separator Pattern. | 
| Object | withObjectInputStream(Closure closure)Create a new ObjectInputStream for this file and pass it to the closure. | 
| Object | withObjectInputStream(ClassLoader classLoader, Closure closure)Create a new ObjectInputStream for this file and pass it to the closure. | 
| Object | withReader(Closure closure)Helper method to create a new Reader for a stream and then passes it into the closure. | 
| Object | withReader(String charset, Closure closure)Helper method to create a new Reader for a stream and then passes it into the closure. | 
| Object | withStream(Closure closure)Allows this input stream to be used within the closure, ensuring that it is flushed and closed before this method returns. | 
| Method Detail | 
|---|
public void eachByte(Closure closure)
closure -  closure to apply to each byte.public void eachByte(int bufferLen, Closure closure)
bufferLen -  the length of the buffer to use..closure -    a 2 parameter closure which is passed the byte[] and a number of bytes successfully read..public Object eachLine(String charset, Closure closure)
charset -  opens the stream with a specified charset.closure -  a closure (arg 1 is line, optional arg 2 is line number starting at line 1).public Object eachLine(String charset, int firstLine, Closure closure)
charset -    opens the stream with a specified charset.firstLine -  the line number value used for the first line (default is 1, set to 0 to start counting from 0).closure -  a closure (arg 1 is line, optional arg 2 is line number).public Object eachLine(Closure closure)
closure -  a closure (arg 1 is line, optional arg 2 is line number starting at line 1).public Object eachLine(int firstLine, Closure closure)
firstLine -  the line number value used for the first line (default is 1, set to 0 to start counting from 0).closure -  a closure (arg 1 is line, optional arg 2 is line number).public Writable filterLine(Closure predicate)
true if the line should be passed to the writer.predicate -  a closure which returns boolean and takes a line.public Writable filterLine(String charset, Closure predicate)
true if the line should be passed to the writer.charset -    opens the stream with a specified charset.predicate -  a closure which returns boolean and takes a line.public void filterLine(Writer writer, Closure predicate)
true if the line should be passed to the
writer.writer -     a writer to write output to.predicate -  a closure which returns true if a line should be accepted.public void filterLine(Writer writer, String charset, Closure predicate)
true if the line should be passed to the
writer.writer -     a writer to write output to.charset -    opens the stream with a specified charset.predicate -  a closure which returns true if a line should be accepted.public byte[] getBytes()
public String getText()
public String getText(String charset)
charset -  opens the stream with a specified charset.public Iterator iterator()
public ObjectInputStream newObjectInputStream()
public ObjectInputStream newObjectInputStream(ClassLoader classLoader)
classLoader -  the class loader to use when loading the class.public BufferedReader newReader()
public BufferedReader newReader(String charset)
charset -  the charset for this input stream.public List readLines()
public List readLines(String charset)
charset -  opens the stream with a specified charset.public Object splitEachLine(String regex, String charset, Closure closure)
regex -    the delimiting regular expression.charset -  opens the stream with a specified charset.closure -  a closure.public Object splitEachLine(Pattern pattern, String charset, Closure closure)
pattern -  the regular expression Pattern for the delimiter.charset -  opens the stream with a specified charset.closure -  a closure.public Object splitEachLine(String regex, Closure closure)
regex -    the delimiting regular expression.closure -  a closure.public Object splitEachLine(Pattern pattern, Closure closure)
pattern -  the regular expression Pattern for the delimiter.closure -  a closure.public Object withObjectInputStream(Closure closure)
closure -      a closure.public Object withObjectInputStream(ClassLoader classLoader, Closure closure)
classLoader -  the class loader to use when loading the class.closure -      a closure.public Object withReader(Closure closure)
closure -  the closure to invoke with the InputStream.public Object withReader(String charset, Closure closure)
charset -  the charset used to decode the stream.closure -  the closure to invoke with the reader.public Object withStream(Closure closure)
closure -  the closure that the stream is passed into.| 
 | Groovy JDK | |||||||||