Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Saturday, June 28, 2008

Can't extend ByteBuffer

java.nio.ByteBuffer is not extensible and this really sucks badly. I didn't realize that till today when I thought to write a custom ByteBuffer implementation and then realized that all the constructors had only package visibility.

The thing is that there are many good reasons why you would want a custom implementation of ByteBuffer . Maybe you want to proxy over another ByteBuffer for example; have an optimized view over a larger ByteBuffer to reduce data copying.

It seems that I was not the only one to feel this way. Check out http://forum.java.sun.com/thread.jspa?threadID=693259&messageID=4028590

It appears that not just a few people, but also whole frameworks like Apache MINA have gone ahead and constructed their own ByteBuffer replacements. Check out http://mina.apache.org/report/1.1/apidocs/org/apache/mina/common/ByteBuffer.html which is extensible.

Saturday, May 31, 2008

Google Collections now in Maven repository

(This blog has been dead for like forever - so many draft entries that were never turned to posts over the last year, but *shrug*)

Google Collections has now been mavenized, or to be more precise - the artifacts are present in the maven repository. Check out Maven Repo1 and the issue that reports this.

Just add the below to your <project>.pom and you are good to go.



<dependency>
<groupId>com.google.code.google-collections</groupId>
<artifactId>google-collect</artifactId>
<version>snapshot-20080321</version>
</dependency>






(Google collection's is like the Apache commons collections but generified)