allow forEachLine block to return Any which avoids possible compile errors from some blocks which return values
This commit is contained in:
@@ -86,7 +86,7 @@ public inline fun File.reader(): FileReader = FileReader(this)
|
|||||||
/**
|
/**
|
||||||
* Iterates through each line of this file then closing the underlying [[Reader]] when its completed
|
* Iterates through each line of this file then closing the underlying [[Reader]] when its completed
|
||||||
*/
|
*/
|
||||||
public inline fun File.forEachLine(block: (String) -> Unit): Unit = reader().forEachLine(block)
|
public inline fun File.forEachLine(block: (String) -> Any): Unit = reader().forEachLine(block)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the entire content of the file as bytes
|
* Reads the entire content of the file as bytes
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ public inline fun Writer.buffered(bufferSize: Int = defaultBufferSize): Buffered
|
|||||||
/**
|
/**
|
||||||
* Iterates through each line of this reader then closing the [[Reader]] when its completed
|
* Iterates through each line of this reader then closing the [[Reader]] when its completed
|
||||||
*/
|
*/
|
||||||
public inline fun Reader.forEachLine(block: (String) -> Unit): Unit {
|
public inline fun Reader.forEachLine(block: (String) -> Any): Unit {
|
||||||
this.use{
|
this.use{
|
||||||
val iter = buffered().lineIterator()
|
val iter = buffered().lineIterator()
|
||||||
while (iter.hasNext) {
|
while (iter.hasNext) {
|
||||||
|
|||||||
Reference in New Issue
Block a user