• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a file using NIO  RSS feed

 
Vinod Kumar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there,
I need help reading a file and storing it as a byte array. I have a bitmap file that I want to read in, and store as a byte[]. Is this possible with NIO. I looked at FileChannels but I can't seem to figure out how to do it.
Any help would be greatly appreciated.
Thanks.
Vinu.
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a response with example code, but UBB claimed it had unacceptable HTML and the message was lost. I'm too annoyed to try again now, but if no one else has responded tomorrow afternoon I'll give it another shot. I'm beginning to think that the talk about switching to Jive is just idle fantasizing chitchat...
[ November 25, 2002: Message edited by: David Weitzman ]
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry I haven't tried posting again. I haven't had access to a computer recently.
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, there isn't really a need to use NIO in this situation. There isn't really a need for it unless you plan to make use of the NIO interfaces, methods, and features (i.e. non-blocking IO, direct buffers that reside in native memory, the position and limit attributes of Buffers, Buffers that a mapped to files, etc.)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!