×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2004
    Location
    Poland
    Posts
    49

    How to get the size of the resource file other way?

    Since InputStream.available() cannot be relied on and block reading [ read(byte[]) ] seems to be error prone - the only way: byte by byte reading the whole stream just to count the number of bytes read to get the size of a file -it, at least to say, takes time, valuable in some situations. Did I miss some way of jar file's size aquiring method, bypassing the mentioned routines?

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    You seem to have answered most of your own questions. There is no way (other than available() which isn't very reliable) to know how big the file is. If knowing this is crucial then you could always add this data as a header of sorts to your files (ie, the first 4 bytes of a file represent an int that is the file size).

    shmoove

Posting Permissions

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