本文节上篇 : http://isilic.iteye.com/blog/1729439
CHAPTER 6:Stream
IO in Java 7
看前言,Java 7 支持Socket Direct Protocol(SDP)协议,支持点到点双向并行数据传输,具体对这个技术感兴趣的可以看下本节。不过IO操作在每次Java版本更新时都是个重点,在实际应用中,这块的更新也是比较受人关注的。大家可以仔细阅读下此节。
- Managing simple files:Files.readAllBytes、Files.write、Files.readAllLines,能够通过Path直接读取文件内容。
- Using buffered IO for files:如果想使用带Buffer的IOStream,请使用Files.newBufferedReader、Files.newBufferedWriter、当然也支持非Buffer的操作,直接得到IOStream,如Files.newInputStream、Files.newOutputStream等
- Random access IO using the SeekableByteChannel:Files.newByteChannel ,可以得到SeekableByteChannel,这个和Seekable接口差不多,支持回读和access directly。
- Managing asynchronous communication using the AsynchronousServerSocketChannel class:AsynchronousServerSocketChannel的Server Socket的使用更加简单方便,使用监听模式,这种server设计更符合胃口。
- Writing to a file using the AsynchronousFileChannel class:异步写文件,这个使用场景得仔细考虑。
- Reading from a file using the AsynchronousFileChannel class:异步读。
- Using the SecureDirectoryStream class:Files.newDirectoryStream可以得到SecurityDirectoryStream,这个类的使用需要os的支持,如果转换失败,说明os并不支持这个Security的DirectoryStream操作。
CHAPTER 7:Graphical
User Interface Improvement
这个是Java的GUI操作的,这块了解不深,做的内容页不多,在此处就只是简单的列出来,对于熟悉Java GUI编程的同学来说,这个也不会是难点。我在这里就少说两句,以免贻笑于大方之家。
- Mixing heavyweight and lightweight components
- Managing window types
- Managing the opacity of a window
- Creating a varying gradient translucent window
- Managing the shape of a window
- Using the new border types in Java 7
- Handling multiple file selection in the FileDialog class
- Controlling the print dialog box type
- Using the new JLayer decorator for a password field
CHAPTER 8:Handling
Events
GUI 操作,同上。
- Managing extra mouse buttons and high resolution mouse wheels
- Controlling focus when displaying a window
- Using secondary loops to mimic modal dialog boxes
- Handling spurious thread wakeups
- Handling applet initialization status with event handlers
CHAPTER 9:Databases,
Security, and System Enhancement
这几个增强点有点不好说,应该说算是跟上规范了吧
- Using the RowSetFactory class:使用RowSetFactory代替了驱动加载的过程,不过得支持JDBC4.1,例子里使用Derby数据库,倒是清晰明了。
- Java 7 database enhancements:数据库的增强,拿到了数据库和表的一些信息,如Schema、AutoGeneratedKeys等;其它增强如伪列(Pseudo-Column),输出类型控制、Driver Log控制等。
- Using the ExtendedSSLSession interface:这块研究不深,不敢往上面写;不过书里的内容还算浅显,大家自己看吧。
- Using the platform MXBeans for JVM or system process load monitoring:这个是JMX的改进,ManagementFactory的功能被增强了,能够获得的JVM的信息增多;操作系统的信息也能作为MXBean的内容得到;还得提一下jconsole,这个是观察MXBeans的好地方,自己注册的MXBean可以在这边查下状态。
- Redirecting input and output from operating system's processes:这个是ProcessBuilder的redirect功能,将输入Input、输出Output、错误Error重定向到文件或者其它地方。
- Embedding a JNLP file in an HTML page:Java Network Launch Protocol(JNLP),直接嵌入到HTML代码中,减少了装载的时间;以前版本的JNLP必须先下载装载完成或才能执行。这个功能还真没有用过,如果有误,请大家及时指正。
CHAPTER 10:Concurrent
Processing
并发编程这块是个重点和难点,这个开发的leader还是Doug Lea,什么,你不知道这个人?好吧,我就当没有听见这句话。终于支持Fork-Join编程模型了啊;单是这个编程模型的支持,就能办好多事啦。这章对于Java开发者来说,都是个不小的诱惑,总想一睹为快。
- Using join/fork framework in Java:典型的Fork/Join模型,ForkJoinPool、RecursiveTask、RecursiveAction等,细节还要看源码。
- Using
the reusable synchronization barrier Phaser
- Using
the new LinkedTransferQueue class:这个是Queue,unbound、FIFO,blocking or non-blocking,Threadsafe;transfer方法是block操作,tryTransfer是立即执行操作,根据情况返回True或者False。
- Using the new LinkedTransferQueue class:这个是Queue,unbound、FIFO,blocking or non-blocking,Threadsafe;transfer方法是block操作,tryTransfer是立即执行操作,根据情况返回True或者False。
- Supporting multiple threads using the ThreadLocalRandom class:官方推荐在多线程下使用Random类,可以使用ThreadLocalRandom,less contention、better performance,好吧,这些都是官方的话,不是我说的。
CHAPTER 11:Odds
and Ends:零碎、琐碎的事情,这个短语向大家推荐下。
好吧,这章介绍的都是一些比较琐碎的支持,如week、currency、Range等,这些修改大家知道就可以,如果能在工作中用到,那也是能简化不小的工作量,如果真是没有印象,也没有关系,大家相信对于这些内容都有自己的原生支持吧。
- Handling weeks in Java 7:好吧,这个week的功能改进太琐碎了,支持weekofYear,currentWeek,week format、CST等,这个改进还真是Odds and Edds。
- Using the Currency class in Java 7:货币支持,这个是好事,不过大家在财务上真的会用这个货币功能吗?精确度是关键。
- Using the NumericShaper.Range enumeration to support the display of digits:这个类是java.awt.font.NumericShaper.Range,这个类真心不了解;看了下,是根据语言的不同,来调整数字输出的,不知道我理解是否正确。
- JavaBean enhancements in Java 7:这个JavaBean颇有Reflection的感觉,看使用方法就能想象出来JavaBean的实现方法。
- Handling locales and the Locale.Builder class in Java 7:本地化,这个功能很使用,问题是,在线上这个本地化操作会影响性能吗?严重怀疑。
- Handling null references:这个例子重写了equals方法来判断obj是否为null,但是我们自己重写equals时不时也是这么 写的吗?后面的两种出来null的方法倒是不错。
- Using the new BitSet methods in Java 7:BitSet新添了几个方法,valueOf、toLongArray、previousSetBit、previousClearBit等,这个类用的不多,不过在某些地方还是有奇效的。
Java 7的更改细究起来还是有不少研究的地方的,只是不知道各位同学有没有在生产环境中用到Java 的新特性。
分享到:
相关推荐
java7 new features cookbook
Java 7 New Features Cookbook.pdf
Java 7 New Features Cookbook
Java 7 New Features Cookbook, by Richard Reese The following applies to example files from material published. Please note that the examples are not production code and have not been carefully ...
Enhance your development skills with Java's state-of-the-art features and projects to make your applications leaner and faster... Make the best use of new Java features and libraries in your applications
Java Language Features, 2nd Edition,介绍了注解,内部类、IO、持久化等java特性。比较适合深入研究的人员。
Java Language Features: With Modules, Streams, Threads, I/O, and Lambda Expressions Work with essential and advanced features of the Java programming language such as Java modules development, lambda ...
java8-new-features总结
Oracle database new features Guide.pdf
My first encounter with the Java programming language was during a one-week Java training session in 1997. I did not get a chance to use Java in a project until 1999. I read two Java books and took a ...
Oracle® Database New Features Guide oracle数据库新特性,官方教程
Creating Pop Up Window Using New Features in WebDynpro Java SAP NetWeaver
Beginning Java 8 Language Features电子书
JDK1.8新特性,New Features in Java SE 8
Oracle Database 10g:New Features for Administrators
The CTP contains a number of walkthroughs, some of which highlight the new language features of C# 4.0. Those are excellent for getting a hands-on guided tour through the details of some common ...
RightFax 9.0 Guide to New Features RightFax 9.0 Guide to New Features
Java Virtual Machine Support for Non-Java Languages: Java SE 7 introduces a new JVM instruction that simplifies the implementation of dynamically typed programming languages on the JVM. Garbage-First...
Core Java Volume II Advanced Features.pdf