Monthly Archives: January 2011
Must remember than SelectionKey.attachment is evil and should never be used to store anything that has a handle on a buffer. Advertisements
Method declarations use the def keyword and follow’s Scalas syntax rules of putting the type after the symbol for argument variables. In our send method below, the statements within look a lot like Java code with some minor differences: On … Continue reading
Scala classes are public by default. It Java, to define a class with a field, you need to define the field an argument in the constructor for that field and an assignment from the argument to the field to initialise … Continue reading
I’ve taken the ROX NIO tutorial code, fixed it up a bit, translated it to Scala and uploaded both the Scala and Java to https://offsync.googlecode.com/svn/tags/rox-nio-tutorial-source I’ll be looking at some of the differences between the Scala and Java code.
I highly recommend the ROX Java NIO Tutorial for learning about Java NIO. Java NIO made no sense to me whatsoever until I read this page.
The first thing that hit me in my first encounter in Scala is the different syntax for the declaration of variables. In Scala it is defined in one of two ways: The first line defines an immutable value (i.e. constant … Continue reading