用修饰器类解决标准I/O的重定向问题  

Resolving the Redirecting of Standard I/O with Decorator Class

在线阅读下载全文

作  者:孔昊[1] 胡银保[2] KONG Hao1,HU Yin-bao2(1.The Software Engineering Department,Lanzhou Polytechnic Collage,Lanzhou 730050,China;2.Network Center,Lanzhou Polytechnic Collage,Lanzhou 730050,China)

机构地区:[1]兰州工业高等专科学校软件工程系 [2]兰州工业高等专科学校网络中心

出  处:《电脑知识与技术(过刊)》2009年第6期1390-1392,共3页Computer Knowledge and Technology

摘  要: 标准I/O的行为方式是从键盘读取数据并在显示器上创建输出信息。如果考虑从文件读取输入,或者将输出结果和报错信息写入文件,可以采用重定向操作满足这样的要求。在标准I/O重定向的实现过程中,根据重定向方法的参数要求和对流进行读取的方式要求,采用合理的修饰器子类对基本I/O流进行层层包装,构造出符合要求的InputStream流对象或者PrintStream流对象,为重定向创建条件。而理解修饰器模式、灵活运用修饰器子类是这个过程中的关键。Reading data from keyboard and displaying data on screen is the standard I/O behavior.Thinking about reading data from files or writing result and erroneous information to files,redirecting action can meet these demands.By the demands of method parameters and reading stream ways,we can use reasonable decorator subclass to package basic I/O stream layer upon layer,construct InputStream object or PrintStream object,creat conditions for redirecting in the course of realization.Understanding decorator pattern and using decotaror subclass flexibly are the keys in this course.

关 键 词:标准I/O重定向 修饰器模式 修饰器子类 包装 

分 类 号:TP311.52[自动化与计算机技术—计算机软件与理论;自动化与计算机技术—计算机科学与技术]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象