zoukankan      html  css  js  c++  java
  • 7.0 Streams

    When I worked on Lab-1, I used Streams, though I hadn't learned that.

    And this time, let me talk about more details of Streams.

    First, let's have a look at a piece of codes.

    //ImplementingBinaryReadWriteToFile

     

    In the above codes, we copy a .txt file FFFF.txt to a new-built .txt file COPY.txt

    Following are two files in the given directory. And they have the same contents. 

    //Implementing buffered I/O

    This time, we still copy the .txt file FFFF.txt, too. However, we used a new way, that is, we copy the file by implementing BufferedStream.

    We get the same result, though.

    //Reading and Writing to a text file

    The third time, we finished the same function but this time we used Streams specially for the text file.

    And this time, I write the output to the console which is the content of the copied file, FFFF.txt. We can also find the new file that copy from FFFF.txt in the directory.

     

    (Don't amazed by the content, it's just some error message that occurred when I ran another program before,,,,,,~) 

    //Warning!

    // While using Streams, don't forget to Close() the Streams after we complete our work with them.

    -----------------END & TO BE CONTINUED-----------------

  • 相关阅读:
    css学习总结
    bootstrap的学习总结
    一些组件配置的理解
    php 微信公众号支付(小程序也是这么支付的)
    mysql 链接超过ip限制时的报错
    php生成二维码
    wamp配置虚拟主机 php 5.6.25
    php 渣全的循环
    4、kafka、spark streaming
    gauss消元
  • 原文地址:https://www.cnblogs.com/lyli/p/4477700.html
Copyright © 2011-2022 走看看