Getting the size of a file without reading it

Hello we are currently implementing a file upload/download framework in our application.
The framework will included multiple filters such as for file mime types, suffices and size of the file.
However, for the size filter, we want to check the size without reading it. This is because reading a file which we would later find unacceptable for our application would mean that we are wasting the resources. 
Since we are currently using an IWDResource object to implement the framework, the method
         IWDResource.getStream(false).available()                                                                                may not come in handy as it seems to read the file to find out its size.
I need to know whether there is some other method or approach we can emply, using IWDResource object, that will not read the file to find out the size.
Thanks alot in advance.

But, it doesn't give me an error, it just gives me the length of the URL, and for some reason it also adds 'D:\jsdk1.4\bin' to the beginning of my URL, so instead of
File webFile = new File(webFileURL.toString());and you would think that it would be similar code to:
File webFile = new File("http://66.185.95.103/8989898904/miko17a.avi");but instead, i've checked the File name, and it was
D:/jsdk1.4/bin/http://66.185.95.103/8989898904/miko17a.avi
or similar code...
File webFile = new File("D:/jsdk1.4/bin/http://66.185.95.103/8989898904/miko17a.avi");why does it add the bin folder of my Java SDK to the beginning??? if it didn't do that, everything would be fine...

Similar Messages

  • How can I get the size of a file with apple script

    I try to get the size of a file within an apple script. But I did not find information how to do this.

    There are two ways. I think Apple is moving toward using System Events, which is listed first.tell application "Finder"
    set myFile to selection as alias
    --this just gets a file for me to work with
    --coercing it into an alias is required for the other functions
    end tell
    tell application "System Events"
    get size of myFile
    end tell
    set myInfo to (info for myFile)
    get size of myInfo

  • How to get the size of a file DONE

    How can I get the size a file? I want to do the following....
    File clobDataFile = new File("clob.dat");
    PrintWriter clobpw = new PrintWriter(new BufferedWriter(new FileWriter(clobDataFile)));
    int               offset     = //get the number of chars in the fileOk I am a tard... figured it out...
    File clobDataFile = new File("clob.dat");
    PrintWriter clobpw = new PrintWriter(new BufferedWriter(new FileWriter(clobDataFile)));
    int               offset     =colbDataFile.length();

    read API http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#length()
    next time you have a similar question please refer this document

  • How do I get the size of a file on a server with an Applet

    Hei,
    I have a problem. I have some files that I need to read in with InputStream to get an Array of bytes. The Applet and the files are on the same server.
    My Prob is, that when I use
    URL(daFile).getFile().getSize();
    it only gives the inaccurate size from the dirlisting (i.e. 48 for 48k)
    So I can not build an array with the correct Size.
    Does anyone knows how I get the correct size of a file.
    Big thx
    LoCal

    Appler can open connections to server it was downloaded from. You don't need such complicated API as RMI... Just simple java server listening for queries.
    Like this:
    Applet:
    1. take a file path
    2. connect to simple server (gives OutputStream and InputStream)
    3. create ObjectOutputStream and send fiel to server (File is serializable)
    4. Read String with size from input stream
    Server
    1. Wait for connection
    2. When client connected create ObjectInputStream and expect File instance
    3. Get file size
    4 Replay with String with size
    Like this...

  • Getting the size of a file on the application server ?

    hi,
    hi everyone !
    i' m trying to transfer a file with the function module FTP_R3_TO_SERVER...
    But for this, i need to know the size of the file i wish to transfer...
    I found out nothing about this, but if anyone have any idea, it would be really helpful...
    thnks.

    HI,
    Why don't you use a ShellScript for FTPing your file.
    You can execute it via ABAP and it will probably does the same
    but you don't have to know how big the file is.
    can think of a few:
    1) Check the F1 help on READ DATASET. It has the addition LENGTH which you should be able to use for this purpose.
    2) Call function SXPG_COMMAND_EXECUTE for command LIST_DB2DUMP. Parse the returned table. You may need to explicitly pass 'UNIX' or 'Windows NT' to the OPERATINGSYSTEM parameter.
    3) CALL 'SYSTEM' ID 'COMMAND' FIELD 'ls -l' ID 'TAB' FIELD result-sys.
    4) Disect AL11 and make use of the same C-calls
    There's probably more...
    if u r sending the data form presentation server (SAPFTP)
    use
    describe table itab line lin .
    size = lin * width of internal row
    If u r sending the data form application server
    read the data in applicaion server file in ur prg internal table and calculate as above and size of file in ftp_r3_to_server fun module
    Cheers,
    Chandra Sekhar.

  • How can I get the size of a file

    I want the size by BYTE.

    [url http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#length()]File.length()

  • How to get the size of uploaded file in sap ABAP MODULE POOL PROGRAMMING

    Hello,
    I am using a fucntion module GUI UPLOAD to upload a file from pc to SAP .
    I want to upload the details of the file.
    i.e TYPE NAME AND SIZE of the file.
    I am unable to do so.
    Help me.
    Gaur Mayank

    Perhaps you could count this by yourself...
    You could approach the correct size by calculating the number of bytes contained in each rows of your table.
    For this you will first need to upload the file to a table of string, so that each field separator is counted.
    something like:
    DATA: lt_data TYPE STANDARD TABLE OF string,
          l_len TYPE i.
    FIELD-SYMBOLS <data> TYPE string.
    "... gui_upload to lt_data              
    DESCRIBE TABLE lt_data LINES l_len.
    l_len = ( l_len - 1 ) * 2.        "Count 2 bytes at end of each line for CRLF
    LOOP AT lt_data ASSIGNING <data>. "Add length of each line
        l_len = l_len + strlen( <data> ).
    ENDLOOP.
    WRITE: l_len.
    This for a single-byte codepage of course... you can use charlen in order to have the length of one char on your system, here I'm asuming it is 1.
    Kr,
    Manu.

  • How to get the size of a file that will be uploaded by download component

    hi i want to show some extra information with download component like size of file how can i do it ?? is anybody having any idea??

    Hi karansheel,
      Use getData().getLength() not working ?
    http://forums.adobe.com/message/4759683
    Thanks,
    Sham
    @adobe_sham

  • How do I know the size of a file

    Hi,
    Would anybody please show me how to get the size of a file. for example, I create a file like this
    FileInputStream FINPUT = new FileInputStream ("c:\\testing.prn");
    I need to know the size of FINPUT before using it but I don't know how.
    note: It is not neccessary to use FileInputStream. I can use any stream or file that allow me to check the size and read out the data from the file byte by byte.
    Thanks a lot.
    Hung

    Thank you for your responding. But, how can I read out the data? I need to read the data from the file byte by byte.
    Thanks
    Hung.

  • Find out the size of a file?

    I need to program a vi, which appends data to a text file.
    The text file may not become larger that a defined size, so the vi should check the size of the file first.
    How can I do this?
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Solved!
    Go to Solution.

    The LabVIEW palette contains a VI for getting the size of a file, it's called 'Get File Size'
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • How to get the size of the file

    Hi All,
    I want to get the size of the file in terms of bytes. I used the following code it returns the value in long how can get it in bytes
    import java.io.File;
    public class ServerBackupCheck {
         public static void main(String args[]){
              File f = new File("C:/Program Files/Apache Software Foundation/Tomcat 5.5");
              System.out.println(f.isDirectory());
              System.out.println(f.getTotalSpace());
    output:
    true
    20964163584
    regards,
    Maheshwaran Devaraj

    if it is a folder you can use this recursive algorithm
    public static long recurse(File f) throws IOException
              long bytes = 0;
              File files[] = f.listFiles();
              for(int i =0 ;i<files.length;i++)
                   File file = files ;
                   if(file.isFile())
                        FileInputStream fis = new FileInputStream(file);
                        byte[] by = new byte[fis.available()];
                        fis.read(by);
                        bytes = bytes + by.length;
                   if(file.isDirectory())
                        bytes = bytes + recurse(file);
              return bytes;
    System.out.println(recurse(f));  gives you the total bytes....
    Ayberk Cansever ..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to get the size of the blob file uploaded ?

    Hi ,
    Is there anyway to get the size of the file i have uploaded to a blob type attribute ?
    What i can see is that when we upload a file in contributor UI ,once the file is uploaded successfully and if we hover on it , it will show the filename , type and size of the uploaded file .
    From where can we get that details so that we can reuse these details in our code ?
    Thanks and Regards,
    Praveen

    A filter is a sensible solution, or you can get it in a roundabout way like this for example if you have the blobid (this is paraphrased from OpenMarket/Gator/AttributeTypes/IMAGEPICKERShowImages.jsp):
    <ics:sql sql='<%="select urldata,filevalue from MungoBlobs where id=" + ics.GetVar("blobid")%>' listname="blobdata" table="MungoBlobs" />
    <ics:listget listname="blobdata" fieldname="urldata" output="urldata" />
    <ics:setvar name="blobpath" value='<%=ics.GetProperty("cc.urlattrpath", "gator.ini", true) + ics.GetVar("urldata")%>' />
    <%
    File blobFile = new File(ics.GetVar("blobpath"));
    long length = blobFile.length();
    %>
    Phil
    Message was edited by: pgleghorn

  • How do I get the Audio Books to stick without error on any of my car

    Good evening all.
    I have been drafting a FAN message in my head for several days now, mainly because I have seen so many people baggin all over the ZEN in a number of posts... It's getting late, and I am resolved to not bore everyone with my rhetorical delights, so - for this night I enter to say: - THANK YOU so very much for the Helpful Hints thread, that was very kind. And 2- The PQI SD cards, both the 2GB as well as the 4GB are a hit with the ZEN as well as all the others mentioned thus far.
    Seems a big crowd is very disappointed with the cans and cant's of the internal memory being able to sync up directly with the SD cards; maybe my total "newby'ness", but I am thrilled with my product... I purchased the 2GB ZEN, and then scored the Bluetooth headphones that were discounted over a hundred bux over the Father's Day weekend.
    I'm a disabled, over the hill gentleman, and wanted a media player to keep me company on the powerwheelchair rides into town and what not... Yes... Being able to drag or send **bleep** from internal memory to the SD card, vice versa would be a treat, but things are workable as is.
    My ONLY problem thus far has been in trying to re-sync a couple of Audio Boox, FROM my ZEN internal flash memory, to my PC (that part looks as if it works out OK, and I can get them imported back into the AudioManager library) and then try to get them to hook in error free to one of the SD cards (it's here where the difficulty occurs)... I'd much prefer to have just music on the internal flash, and then carry all my extras on my cards; but I was all excited and stuff... Tried to take baby bites and little steps, but just couldn't resist digg!
    There is simply no way that I can figure out how to get the Audio Books to stick without error on any of my cards. And therefore I am reluctant to delete them off the ZEN itself.
    Ahhhwell... Li've and learn!
    Overall.. I am tickled green with the Creative ZEN, the Earphones and the investment into the extra 0 gigs of card memory.
    Well... That was a bit longer than I wished, but for ME, it was a pretty **bleep** short write!
    Good night all.. Sleep well...
    gypsy
    OH.. And my daughters little PNY 28mb card works with the unit too
    Admin notes: I moved the message from the locked sticky (undergoing cleanup now) so that others can help.
    Message Edited by KokChoy-CL on <span class='local-date'> 07-6-2008<span class='local-time'> :59 AM

    Even if you could get protected content on the SD cards, AFAIK the Zen won't support bookmarks for files on the SD cards. That would make listening to lectures or audio books on the SD card would be very inconvenient?(who wants to have to remember where their place is, then fast forward to it each time they restart listening to it's). I am curious. Do you have any problems getting the audiobook files to play in the correct order, or do the tags sort them properly? It seems like many series of lectures or other series of audiofiles sort properly on the pc or in mp3 players that use the folder/filename system, but might not sort properly based on the ID3 tags?

  • Getting the size from a model

    Hello
    How can I get the size of a model (from a *.w3d-file). The
    model does not contain the properties width, height or length, so I
    guess that I have to measure the distance between the models
    vertices.
    But I can't seem to think of a good way to do it in. I guess
    a loop of some kind? But it would seem rather unomptimized to
    actually loop through each and every vertex point in the model I
    wan't measured.
    Any suggestions?

    The closest thing to model's dimensional properties is the
    model's boundingSphere property. It gives a radius of an imaginary
    sphere that contains all the vertices of the model; the sphere's
    diameter is the distance between the two farthest-apart vertices.
    However it includes the model's children in the sphere. Set
    yourModel.debug = TRUE to see it.
    You could loop through each model, add a mesh deform
    modifier, go through each mesh[ ].vertexlist, keep track of each
    max and min x, y, and z value, the calculate w, l, h from that. It
    would take a little time... you probably wouldn't want to do it
    every frame. But you could do it on a keypress or something.

  • HT4623 I have updated my iphone 5 with IOS7. Now there is an update 7.0.2 on my cell and the size of update file is showing around 21.0 MB. I tried to update it ITunes but it seems it is downloading the entire IOS. Is there any separate update for the sam

    I have updated my iphone 5 with IOS7. Now there is an update 7.0.2 on my cell and the size of update file is showing around 21.0 MB. I tried to update it ITunes but it seems it is downloading the entire IOS. Is there any separate update for the same or I have to download the entire IOS again?

    Well when you download the update with iTunes it will always download the whole new version (in your case 7.0.2) even if its just an bug fix. If you already have 7.0 download the update over-the-air.
    You already wrote that the update is only 21 MB, so its not the whole firmware package of 7.0.2 you get with iTunes.

Maybe you are looking for