×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Multiple DataInputStreams from the same FileConnection

    Hi,

    My program needs random access to a binary file, and since DataInputStream (or InputStream) don't support seeking backwards, I'm thinking about opening multiple InputStreams, every time I need to go backwards, and then "skip()" from there.

    Does that work?

    Are newly opened InputStreams positioned at the beginning of the file?

    openOutputStream has an overloaded version that takes an offset, but apparently openInputStream doesn't for some reason.

    Also, is skip(long) efficiently implemented in devices? Or is it read and chuck... (the emulator seems to have "real" seek)

    Many thanks!

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: Multiple DataInputStreams from the same FileConnection

    I just tried it out on the emulator and all DataInputStream's are positioned at the beginning! Great!

    Now the only question that remains is -

    Is "skip()" implemented efficiently on phones? (I don't think testing that in the emulator would be enough... and I don't have my phone with me at the moment)

    Thanks

  3. #3
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: Multiple DataInputStreams from the same FileConnection

    skip(1MB) takes:
    5 milliseconds on Nokia 3110 classic
    10 seconds on Nokia E61i
    JSR 75 is really inefficient on S60 phones

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: Multiple DataInputStreams from the same FileConnection

    I see. Thanks.

Similar Threads

  1. FileConnection & Motorola V195
    By arnaultp in forum Mobile Java General
    Replies: 3
    Last Post: 2008-07-08, 16:52
  2. FileConnection for files inside jar
    By ben-efiz in forum Mobile Java General
    Replies: 1
    Last Post: 2008-03-13, 22:36
  3. (FileConnection) Share apps between 6600 and 6630
    By matteopiccioni in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2006-06-21, 21:59
  4. Java FileConnection Optional Package 1.0 (JSR 75)
    By thecrowi in forum Mobile Java General
    Replies: 0
    Last Post: 2004-09-24, 08:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×