标签:import from rri int 分享图片 fromfile bst http tty
1 package big.data.analyse.scala 2 3 import scala.io.{BufferedSource, Source} 4 5 /** 6 * 抽象类型 7 * Created by zhen on 2019/1/6. 8 */ 9 trait Reader{ 10 type url <: java.io.Serializable 11 type content 12 def reader(fileUrl : url) : content 13 } 14 class FileReader extends Reader{ 15 type url = String 16 type content = BufferedSource 17 override def reader(fileUrl : url) = Source.fromFile(fileUrl) 18 } 19 object AbstractType { 20 def main(args: Array[String]) { 21 val fileReader = new FileReader 22 val source = fileReader.reader("C:/Users/zhen/.spyder-py3/发布模块/setup.py") 23 for(line <- source.getLines()){ 24 println(line) 25 } 26 } 27 }
结果:
标签:import from rri int 分享图片 fromfile bst http tty
原文地址:https://www.cnblogs.com/yszd/p/10234808.html