# 20155336 2016-2017-2 "Java Programming" Eighth Week study summary

Source: Internet
Author: User
Tags configuration settings locale string format hosting

20155336 2016-2017-2 "Java program design" Eighth Week study summary textbook study summary

14th Chapter NIO and NIO2

    • About NIO

      NIO使用频道来衔接数据结点,在处理数据时,NIO可以让你设定缓冲区容量,在缓冲区中对感兴趣的数据区块进行标记,像是标记读取位置、数据有效位置,对于这些区块标记,提供了Clear()、rewind()、flip()、compact()等高级操作。
    • NIO2 Introduction

      NIO2文件系统API提供一组标准接口与类,应用程序开发者只要基于这些标准接口与类进行文件系统操作,底层实际如何进行文件系统操作,是由文件系统提供负责。

15th General API

  • Log
  • Features: The

    • java.util.logging Package provides a log function related class and interface IOU, where the starting point for using the log is the Logger class. When
    • calls GetLogger (), the namespace is "." As a hierarchical distinction, the logger of the same namespace level, whose parent logger is configured identically. After the
    • obtains the logger instance, you can use the log () method to output information that can be used to specify the level of information using the static members of levels. The
    • information is filtered by logger and filtered by handler, and a logger can have multiple handler
    • logger instances obtained without any configuration settings, using only Logger.global LOGGER The name namespace logger instance owns the handler, which by default uses Consolehandler, which is the subclass of handler, the function is to output the log information under the console, the default level is Level.ineo
    • Memoryhandle: The log information is not formatted, the information is staged in the memory buffer until the buffer size is exceeded, and the information is output to the specified destination handler.
    • Streamhandler: You can specify the OutputStream instance that is used when the information is output, and it will use the specified formatter formatting information with the child class.
    • Consolehandler: When created, OutputStream is specified as System.err, so the log information is displayed in the console.
    • Filehandler: When you create a log output when you use FileOutputStream, the document location and name can be specified using a pattern string.
    • Sockethandler: You can specify the host location and port when you create it, and the internal network is automatically established to deliver the log information to the specified host.
    • If the handler results provided in the Java.util.logging package do not meet the requirements, you can inherit the handler class, manipulate the abstract method publish (), flush (), and Close () methods to customize the handler.
  • Attention:

    • Logger have hierarchical relationships, the same namespace-level logger, the parent logger configuration will be the same, each logger after processing its own log action, will propagate to the parent logger, so that the parent logger can also process the log.
    • In the absence of any configuration settings, the default is to obtain the LOGGER instance, the hierarchy must be greater than or equal to Logger.globalLOGGERname namespace LOGGER instance set Leve.info, it is possible to output information.
    • The Logger config () is an easy way to output information directly at the leve.config level.
  • Internationalization Basics

  • Use Java.util.ResourceBundle and Java.util.Locale.

  • Use ResourceBundle to do information binding:

     准备一个.propreties文档,(注意:.propreties文档必须放在CLASSPATH的路径设定下)
  • Use ResourceBundle to obtain the corresponding information document based on the underlying name:

     使用指定的Locale对象取得信息文档。 使用Locale.getDefault()取得信息文档。 使用基础名称取得信息文档。
  • Using locale:

     地区信息=语言编码+可选地区编码。 语言编码由两个小写字母代表如zh表示中文(chinese),可选地区编码由两个大些字母表示IT表示意大利(Italy)
  • Rule expression

  • The rule expression mainly uses Yu Gifu, the string format comparison, has the literal meaning character, the character class, the greedy measure word, the gradual quantifier, the single spit quantifier, the boundary comparison, the grouping and the reference and so on.
  • The Java.util.regex.Pattern instance is the representation of the rule representation in the JVM and must be obtained through the static method compile () of the pattern, which can be specified using the Matcher () method, which returns the Java.util.regex.Matche An instance of R that represents the comparer for the specified string.
  • In JDK8, API has added Stringjoiner, arrays and other APIs, and there are also enhancements to the stream-related APIs.
Problems in teaching materials learning and the solving process

There are some problems in learning about the log in this chapter.

    • There is a problem with the call relationship between the logger, Handler, and Fomatter APIs in the book. The information is filtered by the level and filter of the logger and filtered by the level and filter of the handler, the action of formatting information is given to formatter, and finally the output object is called to output the formatted information. Why is it sometimes possible to output information, sometimes not to throw information?

      Later debugging code, carefully read the case study, although handler is responsible for the actual output but need to note that the logger information will be logger to the parent class, this is the first time to contact the logger instance need to grasp, because it will propagate to the parent class, In the absence of any configuration settings, the LOGGER has a default value, the level must be greater than or equal to Logger.globalLOGGERname namespace LOGGER instance set Level.info, it is possible to output information.

    • What is the difference between greedy, progressive, and single-spit quantifiers? Are the three methods of operation the same? Is the result of the same string operation the same? How is it compared?

      After reading, for greedy quantifier, is the whole of the remaining text to eat, in the gradual spit out the text, the results will find as long as possible in line with the text. And the gradual quantifier, is one side to eat the remaining text, while looking at the text is not eaten to compare, alone spit words will be eaten, and then see if the word alone spit words in line with the text to eat, obviously through the characteristics of the three can judge the difference; At first thought that the result of the same character came out is the same, But for the example in the book Xfooxxxxxxfoo, the result of the three operations is different, compared to the comparison method using the given rule expression.

Problems in code debugging and the resolution process
    • In the rule expression, the expression of the meaning character of the polygon, for the list of commonly used literal meaning character a bit of a problem, reading examples, using the split () method to cut.

      //规则表示式\\撰写为Java字符串是"\\\\"for(String token:"Justin\\Moinca\\Irene".split("\\\\"){out.println(token);}

      The point is to grasp the need to add the ignore symbols, for example to compare! , you must use \! And so on, it will be much easier to understand the problem.

    • In the rule expression, the boundary comparison problem, the book gives the example RegularExpression SplitDemo2, uses the previous split () method to cut. where for (String str: "Justin dog Monica doggie Irene". Split ("dog") This line of code cuts out the results that are not imagined.

      Because there are also dog in the doggie need to mark the boundary use \b , the code is modified tofor(String str : "Justin dog Monica doggie Irene".split("\bdog\b"))

      But the results are not yet imagined, and the example of RegularExpression SplitDemo3, which was later observed, found an error, although the character \b is a boundary, but Java will use it \b \ as an ignore symbol at compile time. The result is that the spilt () method is used for cutting with Bdog, because \b the \ boundary symbol naturally causes problems if it is treated as an ignore symbol. The code should be changed tofor(String str : "Justin dog Monica doggie Irene".split("\\bdog\\b"))

      This \b is used as a boundary symbol and the result is correct.

Code Hosting

Pairing situation

Other (sentiment, thinking, etc., optional)
java知识的学习,已经渐渐的接近了尾声,现在的一些知识点看起来会简单一些,但是依然不能掉以轻心。这些方面的知识可能对于我们现在的编程可能用处不大,但是这些知识并不是代表用不上,不是代表看过就算结束,很大的一部分程度是需要了解和掌握,并且消化的知识,而且这  些知识也有对之前只是的掌握扎实程度的检验,现在接触的各个类、各种方法之间的继承关系,操作对象不都是的顺序与目标不都是原来的知识。所以这些知识是要了解并且掌握的。
Rating Standard (10 points)
    1. From 0 minutes to 10 minutes.
    2. Correct use of markdown syntax (plus 1 points):
      • Do not use markdown do not add points
      • There are grammatical errors of no points (link cannot open, the table is wrong, the list is not correct ...) )
      • No extra points for typesetting confusion
    3. Complete features in the template (plus 1 points)

      • Lack of "The problem in teaching material learning and the solution process" without extra points
      • Lack of "problem in code debugging and resolution process" without extra points
      • Code hosting does not open without extra points
      • Lack of "pairing and mutual evaluation" cannot be opened without extra points
      • The lack of "Last week's exam error Summary" Cannot add points
      • Missing "progress bar" cannot be added
      • Lack of "reference" cannot be added
    4. Problem and solution process in textbook learning, one question plus 1 points

    5. Code debugging problems and resolution process, a problem plus 1 points

    6. Valid code for this week exceeds 300 branches (plus 2 points)

      • Less than 20 times a week of submissions

6 Other bonus points:-Friday ago Blog Add 1 points-impressions, experience not false big empty plus 1 points-beautifully typesetting plus a point-the progress bar record learning time and improve the addition of 1 points-have to write a new code plus 1 points-after-class selection with the validation of 1 points-code commit message specification plus 1 Points-Wrong topic learning in-depth plus 1 points 7 points:-There is a copy of the deduction to 0 points-code cheating deduction to 0 points

Reviews Template:
    • Based on the scoring criteria, I scored this blog: 10. The score is as follows:

      • Correct use of markdown syntax
      • Complete features in the template
      • The problem and the solution process in the textbook learning, a question adds 1 points, altogether two
      • Code debugging problems and resolution process, a problem plus 1 points, altogether two
      • Valid code for this week exceeds 300 branches (plus 2 points)
      • Feelings, experience is not false big empty plus 1 points
      • Add 1 points to write new code
      • Add 1 points to the Code commit message specification
      • After-class selection with validation plus 1 points

The 10 points, or is not enough to add ~ ~ ~

reviewed the classmates blog and code

20155320

20155327

20155315

20155202

Learning progress Bar
             | 代码行数(新增/累积)| 博客量(新增/累积)|学习时间(新增/累积)|重要成长|  --------   | :----------------:|:----------------:|:---------------:  |:-----:|| 目标        | 5000行            |   30篇           | 400小时            |       || 第一周      | 200/200           |   2/2            | 20/20             |       || 第二周      | 300/500           |   2/4            | 18/38             |       || 第三周      | 500/1000          |   3/7            | 22/60             |       || 第四周      | 800/1300          |   4/9            | 30/90             |       || 第五周      | 1800/2000         |   5/9            | 45/100            |       || 第六周      | 2400/3000         |   6/10           | 60/100            |       || 第七周      | 3100/4000         |   7/11           | 75/100            |       || 第八周      | 3700/4500         |   8/12           | 90/110            |       |

Reference: Why is it so difficult to estimate software engineering applications, software engineering estimation methods

    • Planned study time: 21 hours

    • Actual learning time: 15 hours

    • Improve the situation: have time to look at the software engineer's ability self-evaluation table

Resources
    • Java Learning Notes (8th Edition)

    • Java Learning Note (8th Edition) Learning Guide

    • ...

# 20155336 2016-2017-2 "Java Programming" Eighth Week study summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.