Restore deprecated InputStream.iterator() with a replacement.
This commit is contained in:
@@ -6,6 +6,9 @@ import java.io.*
|
|||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
import java.util.NoSuchElementException
|
import java.util.NoSuchElementException
|
||||||
|
|
||||||
|
@Deprecated("It's not recommended to iterate through input stream of bytes unless it's buffered. Use buffered() extension on stream to make it buffered.", ReplaceWith("this.buffered().iterator()"))
|
||||||
|
public operator fun InputStream.iterator(): ByteIterator = buffered().iterator()
|
||||||
|
|
||||||
/** Returns an [Iterator] of bytes read from this input stream. */
|
/** Returns an [Iterator] of bytes read from this input stream. */
|
||||||
public operator fun BufferedInputStream.iterator(): ByteIterator =
|
public operator fun BufferedInputStream.iterator(): ByteIterator =
|
||||||
object : ByteIterator() {
|
object : ByteIterator() {
|
||||||
|
|||||||
Reference in New Issue
Block a user