
Java 编程
文章平均质量分 76
lesky
每一次转型都是如此之爽...
展开
-
使用FileChannel读取文件
Once you call read( ) to tell the FileChannel to store bytes into the ByteBuffer, you must call flip( ) on the buffer to tell it to get ready to have its bytes extracted (yes, this seems a bit crude,原创 2006-11-12 14:06:00 · 4489 阅读 · 0 评论 -
Java中的对象序列化Serializable
如何把对象序列化:Serializable接口可以实现对象的序列化,其目的是,将程序中的一个对象存储或通过网路传输,然后在另一个程序中还原出一个和原有对象一致的对象。可以通过指定关键transient使对象中的某个数据元素不被还原,这种方式常用于安全上的保护。比如对象中保存的密码。应注意的是被序列化的CLASS应该能在还原处的classpath中找到类的定义。import java原创 2006-11-12 14:11:00 · 1203 阅读 · 0 评论 -
How to initialize a shared fixture in Junit
How can I run setUp() and tearDown() code once for all of my tests? The desire to do this is usually a symptom of excessive coupling in your design. If two or more tests must share the same test fix转载 2006-11-12 14:53:00 · 919 阅读 · 0 评论 -
关于Java继承中的Pivate变量
继承中有个很有趣的地方,private method不会被继承到子类当中,但是继承到子类中的public方法却可以使用private方法,因为它是类接口的一部分。那么private变量呢?是否private变量被继承到子类里了呢abstract class Event ...{ private int eve; // eve is a private variable publ原创 2006-11-12 13:55:00 · 1141 阅读 · 0 评论 -
如何配置JNDI数据库连接池
一般来说,jsp接收到请求的时候,就向数据库要求一个连接,当执行完成后再断开连接,这样的方式将会消耗大量的资源和时间。因为每次向数据库建立连接的时候都要将Connection加载到内存中,再验证用户名和密码,等一切结束通过后,再与用户建立连接,断线后又要重来一次。如此冗长的程序,既耗时又没有效率,因此我们采用连接池来优化这个问题。连接池的运作方式是一开始向数据库要求很多的Connection原创 2006-11-20 19:45:00 · 1878 阅读 · 0 评论