Trying to read a file but doesnt know how to get the size of the inputstrem

hi im trying to read a file in a cel this is my code:
fconn = (FileConnection)Connector.open("file://localhost/" + actualdir);                     
InputStream fis = fconn.openInputStream();                                                 
byte b[] = new byte[1024];                                                                         
fis.read(b);                         
fis.close();
fconn.close();   
textBox1 = new TextBox("Viendo el Archivo: " + list1.getString(list1.getSelectedIndex()), null, 1024,TextField.ANY | TextField.UNEDITABLE);                       
                          textBox1.setString(new String(b, 0, b.length));                        i dont want to create always an array of bytes of size 1024 instead i wanna know how many bytes does inputstream object has, how can i know that?

you can either retrieve the whole file at once by determine the file size like:
fconn = (FileConnection)Connector.open("file://localhost/" + actualdir);
InputStream fis = fconn.openInputStream();
byte b[] = new byte[fconn.fileSize()];
fis.read(b);
fis.close();
fconn.close();
or read every single byte
fconn = (FileConnection)Connector.open("file://localhost/" + actualdir);
InputStream fis = fconn.openInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int i = fis.read();
while(i != -1){
baos.write(i);
fis.read();
String content = new String(baos.toByteArray());

Similar Messages

  • My Imac HD wont start, I need to back up my files but dont know how to get in to do this now, help?

    My Imac wont start, I have been in to the repair disk section and it came up with
    "Disk Untility cant repair this disk.  Back up as many of your files as possible, reformat the disk, and restore your backed up files"
    How do I do this please, someone help.  I need it explained as simply as possible. 
    Help

    Are you saying you don't have a backup now? If not and the HD cannot be repaired then your only choice is expensive data recovery services. However I think when you find out the cost you will abandon it. Backup isn't something that should be done, it is something that must be done to protect your valuable data While I know this is not what you wanted to hear it's the truth. When you get your iMac repaired get an external HD and begin using Time Machine, it's built right into OS X. You can find out more about it in Mac Basics: Time Machine backs up your Mac - Apple Support. Next buy a second EHD and create another backup, when it comes to backup redundancy is extremely wise as backup can fail too. You can get a utility such as Carbon Copy Cloner or SuperDuper and create a bootable clone. NEVER EVER use one EHD to create multiple backup schemes. This is a false economy and due to the relatively low prices of EHD's there is no excuse to not have redundant backup.
    Good luck and I hope you are able to get some of your data back.

  • Let me know how to get screen size of user..

    Hi.
    I'm going to change a container size in a screen, dynamically.
    I want to know that an user's screen is 1024X768 or others..
    Let me know how to get screen size of user's computer.
    Best Regards.
    Kil - Nam.

    Look at Re: SAPgui window size (+)
    Regards

  • HT201441 WHAT IF YOU DON'T KNOW HOW TO GET IN CONTACT WITH THE PREVIOUS OWNER.

    I recently purchased a ipad and I didn't no that it had a icloud attached to it when I bought it.  After  I purchased it and l tried to reset the password the activation page showed that I needed to to know that apple id and password of the previous owner I called and they said they that they didnt not know it either.  So what can I do about this.

    Welcome to the Apple community.
    Unfortunately, you cannot do very much with your phone unless you get assistance from the previous owner, they should either provide you with the password to unlock it or remove their account from the phone entirely remotely through iCloud.com > Find My Phone. Take it back and get a refund.

  • HT4053 I am setting Iphone 4,  I am at the world clock and don't know how to get past theat to the next step

    Can you help me to set up my first iphone.  I have entered the time, but can not get past that to the next screen.  What do I need to do.

    Re: That garbage is unreadable.
    If you really want help, stop messing with the fonts and post so that others can read and offer suggestions.
    Or better yet... try a search, I'm certain you'll find a solution to whatever issue you're experiencing.
    I have found that many times it is the things that make you most angry that push you to action. This was the case here. Thank you for causing me to get so angry that I found the answer myself.

  • The Display on my 6th gen nano has flipped sideways, and I don't know how to get it back to the right side up.

    The display on my 6th Generation Nano has flipped sideways, and I can't figure out how to get it to flip back.

    Place your fingers onto the screen and gently (but firmly!) drag the screen around to the upright position.
    Hope this helps.

  • On some pages,the things are shriking or are coming up really big do you know how to get them back to the normal size?

    on some pages,the things are shrikingg and becoming big,i just want them back to the normal size,i dont know how do that,could anyone help?
    thank you...

    Try resetting the zoom level for those pages.
    See this:
    https://support.mozilla.com/en-US/kb/Page+Zoom

  • A lady at Best Buy erased everything off my iphone 3gs, now when i try to download facebook app it said it requires ios 4.3. I have hooked it up to itunes and everything but nobody knows how to get the ios 4.3 on this phone. HELP someone plz

    I need help on how to download the ios 4.3. to my iphone 3gs. My mom was using it and everythig was fine but when she upgraded the lady erased everything so it would be like new and now when i try to download a app like facebook it says it requires ios 4.3. and i have asked people at phone places and i have hooked it up to itunes and still havent been able to..when i go to settings then general it doesnt show up any software updates, that whole part is erased. someon eplease help me!\

    What version of iOS are you running? I'm going to bet that you do NOT have a 3Gs. You have a 3G. The highest version of iOS that can run is 4.2.1.
    If you did not save a copy of the older facebook at that could run on 4.2.1 on your computer that you can sync back, then you're out of luck. The newest version (and the only one available in the app store) will not run on 4.2.1. 
    You will have to resort to using the mobile web page in Safari or find a 3rd party app that will run on your phone.

  • When i start firefox, it automatically does a search for I-play and displays an icon for I-play when firefox completes its loading. I dont want the i-play search to be done, but dont know how to get rid of it.

    I downloaded and installed the I-play program from their website, but then decided i didnt want it, and uninstalled it through windows 7 program and features. The I-play search issue began at the same time I installed the program, but didnt go away when i uninstalled the program

    To get rid of Bing Search Window..............
    Click on View tab / Tools and un-check 'Search' (alias for 'Bing')

  • Can send my Journal to my PC but I do not know how to get a copy of the journal to a smart drive or disc HELP

    Sent my Jornal from iPhoto to my Dell lap top PC
    HOW can I copy the photos for a slide show on a smart drive or burn to disc?
    Need to make a presentation and would like to have a copy and not reley on the cloud or Itunes
    Marlene

    Yes, on the right side of the U.K. Apple Store homepage there will be an "Education Store." You can get something like 10% off, it seems.

  • TS2972 I have created a home share and want to transfer song from old computer to new. I see library on new computer, but dont know how to get it to stay there.

    I have read all the material and still have not found a answer to my question

    Copy the ENTIRE iTunes folder from the old computer to the new computer.

  • Support;   Anyone know how to get .mac support on the phone?

    It appears the only way to get help concerning a .mac issue is by emailing them and waiting 24 hours or trying this discussion board. Anyone know of way to call them?
    Thanks

    Thanks Duane, Does anyone else find it disturbing that you can't call .mac with support issues? I guess it's a matter of pragmatism on apple's part. What if you can't receive email? How do they help you? Or what if you have an immediate problem like a business that depends on its email etc. ?
    I use Mac b/c it is user friendly and a pretty darn good system and I am a computer idiot. But if something goes wrong, where's the help?

  • Anyone know how to get ringtones back on the iPhone

    after iOS5 download?  Created folder, sync again, still does not work.

    Open iTunes, select your phone under Devices, and select that you want to sync ringtones. It will do it wirelessly if you have your phone set up that way. If not, plug it in and do the same thing.

  • Don't know how to get printer online. currently offline 3520 deskjet

    HP 3520 deskjet.  Can't print.  Printer reads offline.  Don't know how to get it online (ready).  I tried reloading it, but error message came up.
    HELP!

    Hello there! Welcome to the forums @mattiesmom !
    I read your post about how your Deskjet 3520 is showing offline and is not printing.
    I will certainly help!
    Please follow all of these steps, in order, and you should be back online and printing afterwards:
    'Printer is offline' Message Displays on the Computer and the Printer Will Not Print: Windows Vista
    Feel free to write back to let me know the results!
    R a i n b o w 7000I work on behalf of HP
    Click the “Kudos Thumbs Up" at the bottom of this post to say
    “Thanks” for helping!
    Click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution!

  • DOSE ANYONE KNOW HOW TO PUT A DVD ON THE IPOD!?!

    hello. my name is Patrick, and i am very good with iPods and computers, but i dont know how to get DVD's on the iPod, SOME ONE PLEASE HELP! i realy dont want to buy the movie all over agian when i have the DVD
    Windows   Windows XP  
    Windows   Windows XP  

    Don't say anything's idiot proof. You obviously haven't been on the forums that long.
    HaHaHa!!!

Maybe you are looking for

  • How to restore the balance from my apple id to the card again ?

    I Had redeemed 15$ balance and i had forget my secure questions as the apple id is old for me although my e-mail is available but i didn't recieve any email to verify my id what should i do now ?

  • Weblogic Server 6.1 trial version fails to install in Linux

    Weblogic Server 6.1 trial version fails to install in Linux (in Linux Redhat 6.2, jdk 1.2.2) 1. When unzipping the *.zip file "weblogic610_generic.zip", the unzip program reported that some files and directories not properly named. (using winzip, qui

  • PO printing to extenal (e-mail). Changing Vendor e-mail address.

    Guys, Sorry for being persistant with this issue. I only have data in test environment and screen debugging is not allowed in that environment at the moment so I can easly break-point when I save the message in Me22N. I can kick in the debugging sess

  • Signal booster app not working

    hi .i just downloaded the signal booster app on my bb curve.it debited money frm my visa card and also sent me a confirmation email but when i try to run the app it keeps asking me to upgrade to pro version .can anyone advise me on what to do to fix

  • System exec subvi. can't access block diagram for positionin​g

    OK I am back! my first issue is that for some reason I can no longer attach files here for you all to see... Second and more to the point is how can I tell the system exec.vi to open where I want it too when access to the block diagram is password pr