charinputstreamiterator.scala
来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 53 行
SCALA
53 行
/* __ *\** ________ ___ / / ___ Scala API **** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **** /____/\___/_/ |_/____/_/ | | **** |/ **\* */// $Id: CharInputStreamIterator.scala 12244 2007-07-09 11:11:29Z michelou $package scala.util.parsingimport java.io.InputStreamimport java.io.{IOException, EOFException}/** This class ... * * @author Burak Emir * @version 1.0 * * @deprecated use classes from <a target="contentFrame" href="input.html"> * <code>scala.util.parsing.input</code></a> instead. */@deprecatedclass CharInputStreamIterator(in: InputStream) extends Iterator[Char] { private var ch: Int = _ private var chSet = false private var error: IOException = null private def lookahead() { try { ch = in.read(); chSet = ch >= 0 } catch { case ex: EOFException => ch = -1 case ex: IOException => ch = 1; error = ex } } def hasNext: Boolean = { if (!chSet) lookahead() chSet } def next(): Char = { if (!chSet) lookahead() chSet = false ch.asInstanceOf[Char] }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?