标签:user read cal create bsp rom 结果 created http
1 package big.data.analyse.scala 2 3 import java.io.File 4 5 import scala.io.Source 6 7 /** 8 * 隐式转换 9 * Created by zhen on 2019/1/6. 10 */ 11 class RichFile(val file:File){ 12 def read = Source.fromFile(file.getPath()).mkString 13 } 14 object Context{ 15 implicit def file2RichFile(file:File) = new RichFile(file) 16 } 17 object ImplicitConversion { 18 def main(args: Array[String]) { 19 //导入隐式转换 20 import Context.file2RichFile 21 println(new File("C:/Users/zhen/.spyder-py3/发布模块/setup.py").read) 22 } 23 }
结果:
标签:user read cal create bsp rom 结果 created http
原文地址:https://www.cnblogs.com/yszd/p/10234813.html