共 18 篇文章 |
|
在我们HttpClient client = new HttpClient()这样实例化一个client时connectionmanager是这样被实例化的Java代码 this.httpConnectionManager = new SimpleHttpConnectionManager(); 因此alwaysClose默认是false,connection是不会被主动关闭的,因此我们就有了一个客户端关闭链接的方法。 阅372 转2 评0 公众公开 11-10-11 14:20 |
阅1408 转3 评0 公众公开 11-10-11 13:25 |
System.out.println("Is str1 blank? " + StringUtils.isBlank(str1));System.out.println("Is str2 blank? " + StringUtils.isBlank(str2));System.out.println("Is str3 blank? " + StringUtils.isBlank(str3));System.out.println("Is str4 blank? " + StringUtils.isBlank(str4));System.out.prin... 阅584 转7 评0 公众公开 08-11-12 13:26 |
在前面的专题文章中,我们一起过了一遍org.apache.commons.lang包,接下来我们继续看org.apache.commons.lang.builder这个包。import org.apache.commons.lang.builder.Staff staff1 = new Staff(123, "John Smith", new Date());System.out.println("staff1 equals staff2? " + staff1.equals(staff2));public Staff(long... 阅1137 转7 评0 公众公开 08-11-12 13:26 |
好了,来看我在Common Lang中最后要讲的一个包:org.apache.commons.lang.time。package sean.study.jakarta.commons.lang;import org.apache.commons.lang.import org.apache.commons.lang.time.System.out.println("ISO_DATETIME_FORMAT: " + isoDateTime);System.out.println("Round HOUR: " + DateUtils.round(date, C... 阅1218 转8 评0 公众公开 08-11-12 13:24 |
在Jakarta Commons中,专门处理数学计算的类分别可以在两个地方找到:一是Commons Lang的org.apache.commons.lang.math包中,二是在Commons Math这个单独的子项目中。org.apache.commons.lang.math包中共有10个类,这些类可以归纳成四组:import org.apache.commons.lang.math.Commons Lang的math包的各个类都还有很多实用的方法,远不止我在例... 阅1693 转7 评0 公众公开 08-11-12 13:22 |
Bag是在org.apache.commons.collections包中定义的接口,它extends java.util.Collection,而它的实现类都被放在下面的bag包中。import org.apache.commons.lang.builder.public Book() {public Book(String name, String isbn, double retailPrice) {public void setRetailPrice(double retailPrice) {import org.apache.commons.collections.... 阅377 转10 评0 公众公开 08-11-12 13:21 |
Commons Collections,又是一个重量级的东西,为Java标准的Collections API提供了相当好的补充。org.apache.commons.collections -Commons Collections自定义的一组公用的接口和工具类。org.apache.commons.collections.buffer -实现Buffer接口的一组类。org.apache.commons.collections.collection -实现java.util.Collection接口的一组类。or... 阅626 转8 评0 公众公开 08-11-12 13:20 |
Commons Collections在java.util.Map的基础上扩展了很多接口和类,比较有代表性的是BidiMap、MultiMap和LazyMap。import org.apache.commons.collections.import org.apache.commons.collections.bidimap.import org.apache.commons.collections.map.import org.apache.commons.lang.multiMap.put("Sean", "Java");简单说... 阅715 转13 评0 公众公开 08-11-12 13:19 |
来看Buffer组。Buffer是定义在org.apache.commons.collections包下面的接口,用于表示按一定顺序除去成员对象的collection如队列等。具体的实现类在org.apache.commons.collections.buffer包下可以找到。import org.apache.commons.collections.Buffer;import org.apache.commons.collections.buffer.import org.apache.commons.lang.Buffer bu... 阅366 转10 评0 公众公开 08-11-12 13:18 |