• Post Reply Bookmark Topic Watch Topic
  • New Topic

convert java.nio to equivalent in 1.3  RSS feed

 
iulia dobai
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

My problem is as follows. I have an application developed under java 1.4 that uses java.nio (available in 1.4 only). I have to make this application compatible for java 1.3 (due to the device it has to run on: PDA). I would really like to avoid rewriteing the application without using java.nio. So I am thinking at either an alternative implementation for java.nio or some other way to go arround it.

Any help is grately appreciated.

iulia
 
Joe Ess
Bartender
Posts: 9426
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, iulia.
If you are doing run-of-the-mill IO, it should be pretty easy to port your application to JDK 1.3. However, if your app relies on NIO-specific functionality, like locking files, non-blocking IO and so on, you will probably have to resort to native code to duplicate it in the earlier JDK.
 
iulia dobai
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what about java.nio.charset and java.nio.channels ???
I am using them extensively in the last version.

Thanks
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hard to say - it depends on what methods you're using. If you're using nonblocking channels, or selectors, then you're going to have a hard time finding equivalent functionality in JDK 1.3. I think most other things have equivalents in 1.3. I don't think there's a single quick fix to this problem though - you'll have to go through the code to see what there is to do.

Note that I've found it useful to do most of my IO through helper classes - e.g. a FileUtil class with methods like copy(File, File) or methods to read and write a String to a text file and vice versa. Among other benefits, this allows be to change underlying implementations with relative ease. You may also want to check out Jakarta Commons IO. Classes like FileUtils and IOUtils are particularly useful.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!