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...

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 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 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 can i change the size of PDF files ?

    how can i change the size of PDF files? when i convert documents in the acrobat browser it seems the files become larger then normal pdf files, this is, i compare with other files that people send to me and i realise that they are smaller than my converted files, even if they have more pages.

    A lot depends on the form of the PDF. Is it graphics, a scan of a text file, pure text, or other? What version of Acrobat are you working with.
    You can do a save as to get a WORD file, but do not expect great results. The ability to get a decent WORD file depends on what the form of PDF you are working from. If it was created from WORD with tags and all, you might get good results. If not, you might get a lot of messed up results.
    Explain what you are starting with and your ultimate goal. Also check the audit of the file (should be under PDF Optimize) to see where the file information is concentrated (text, fonts, graphics, other).

  • 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.

  • How do i get the driver to use an HP laserjet 5mp with my Mac that runs Lion?

    how do i get the driver to use an HP laserjet 5mp with my Mac that runs Lion?  I'm told by HP to get it through Apple updates but it doesn't show up. 

    The term "server", while technically correct, is misleading.  A print server takes the low-level protocol spoken by a printer and serves it over a higher-level protocol.  For example, parallel printer port (a.k.a. Centronics or IEEE 1284) and serve it over USB.  Or parallel or USB and serve it over Ethernet with a variety of printing protocols (lpr/lpd protocol, JetDirect protocol, port 9100 protocol, the names are confusing).
    In reality, a print server looks nothing like what we usually associate with "server" (which is typically a biggish computer).  Instead they usually look like adapter plugs or even adapter cables, or like a little network hub (just with printer connectors instead of network connectors).
    Here are a few examples (I'll use Amazon as a guide book, without implying that I endorse them).  Let's start with USB to parallel; it seems they tend to look like adapter cables.  Here is one that takes a USB plug (male) and creates a female port that you can plug your regular old printer cable in: http://www.amazon.com/Cables-To-Go-16899-IEEE-1284/dp/B000UX21PY/ref=sr_1_1?ie=U TF8&qid=1333640548&sr=8-1
    And here is one that goes from a USB plug directly into the printer: http://www.amazon.com/Parallel-Printer-Adapter-Connect-parallel/dp/B000BV8604/re f=sr_1_4?ie=UTF8&qid=1333640548&sr=8-4 replacing the old printer cable.
    Then there are (really cheap) Ethernet to printer adapters.  Here is one that you put into the printer (warning, the plastic cover will probably not fit afterwards): http://www.amazon.com/TP-Link-AC-TL-PS110P-Single-Parall/dp/B003CFATR4/ref=sr_1_ 11?s=electronics&ie=UTF8&qid=1333640755&sr=1-11 By the way, I really don't like this type, I always find them unreliable.  But they are cheap.
    The ones I like look more like a network hub. Here is the NetGear PS110: http://www.amazon.com/NETGEAR-PS110-parallel-Ethernet-100Base-TX/dp/B0002AF9JU/r ef=sr_1_2?ie=UTF8&qid=1333640860&sr=8-2
    And the HP external JetDirect: http://h10010.www1.hp.com/wwpc/us/en/sm/WF05a/18972-18972-236253-34214-64302-273 16.html?dnr=1&jumpid=reg_r1002_usenc-001&lang=en&cc=us (I think this is the best one of the lot).  Both of those you put next to the printer, use your existing parallel printer cable, and connect them to the network.  Don't get scared by the astronomical price of the HP; it's commonly available used.
    There are even some wireless models around.  In theory, you might be able to use a parallel-to-USB adapter cable and then plug the USB cable into your trusty Apple Airport (as a good Apple fanboy or fangirl you've bought an Airport, right?), but I don't know whether that will work.  With the HP JetDirect box I'm quite certain that it will work (but it's old-fashioned, doesn't come in white, doesn't do wireless, and is not the slightest bit hip or cool).

  • How on can get the plaback of .mov files with Redcode Codecs?

    Hi folks,
    I am not able to play the .mov files created by Red camera so..
    how one can get the playback of .mov files with Redcode Codecs?

    Well, one typically doesn't edit with any of the proxy-files the RED camera produces.  You need to convert the RED footage to ProRes.  Log and Transfer can do this, if you download and install the RED Log and Transfer plugin.  Or you might need to use RED software to convert the footage to ProRes.  But those Red proxy files won't import via log and transfer, and are NOT editable in FCP.  Gotta convert to ProRes.

  • By mistake, I shrink the size of a particular page, which firefox then remembers. How do I get the size back to normal?

    When moving around on websites, somehow I manage to shrink the size of what is shown on the screen. I have not figured out how to get the size back to 'normal'. However, Firefox remembers this so when I reenter this particular size, it will still be in the smaller format. Very frustrating and as this has happened for at least two of my most watched sites, I am more and more using competing formats, e.g. Explorer.
    I have alsl asked more experienced users of Internet to try to solve this but they are as lost as I am.
    Looking forward to getting your advice.
    Best regards,
    Lars Henriksson

    You can hit CTRL++ to zoom. Or install these add-ons:
    https://addons.mozilla.org/en-US/firefox/addon/theme-font-size-changer/
    https://addons.mozilla.org/en-US/firefox/addon/zoom-page/

  • How do I get the size of a variable on runtime while...

    Hi,
    I want to get the size of a variable which is storing an xml input from db.
    I want to get the size of this variables on several intervals like displaying a message when the variable holds the data = one megabyte and then so on .
    is it even possible to get the size in runtime?
    guidance is greatly appreciated.
    thanks

    So you are looking for the total size of all the objects which go together to make the DOM implementation of your XML. Even if you could find that in any particular case, it would only be a rough guide. I suspect that if you have a few large text nodes in your XML, the DOM will be smaller than if you had many small text nodes, because it would require fewer supporting objects.
    If you are interested in a rule of thumb, Michael Kay (who wrote the Saxon XSLT transformer product) suggests that 10 megabytes of XML is about the largest practical file size at the present time. I have however seen claims of people transforming files as large as 30 megabytes.
    However, since you are sending the result to a browser, I don't see how you can handle that much data anyway. First of all it is going to take minutes to load into the DOM, while the user waits, and secondly you are going to have to summarize it heavily to be of any use to the user, which suggests that you should store it in some other format that is easier to summarize.

  • How do I get the date of a file in an FTP?

    As stated in the subject.
    I am at wits end trying to get the date of a file from FTP(Stuck for days).
    I tried the "URLConnection" Class but could only get me the size of the file with "getContentLength()"
    "getContentDate()" & "getLastModified()" both give me a 0. They only works for files on HTTP but not FTP.
    Anyone has any simple solution on how to get the date of a file on FTP?
    Thanks in Advance.

    The FTP specification has long awaited the magical file meta-data access protocol, which never came. There is no FTP defined manner to obtain the date of a file. The common work-around is to get the containing directory list and <shudder> parse the format of the returned text for the target file and date. Since there is no standard directory listing format, there is no guarantee that you will be able to get that date, and your application would have to cry to the user for help.
    Some FTP applications, in addition to providing parsers for Unix/Linux and DOS/Windows directory list formats, also provide the user with a format definition script to parse whatever the user encounters.
    I hope you find this of some help.

  • How do I get the Organizer to show file names?

    I'm lost and confused in Photoshop 13. How do i get the file names to be displayed in Organizer? I've chosen to keep the older version of the "grid" display and miss having the file names showing. I've searched the online manual but can't seem to find what I need!

    ManyOldPhotos a écrit:
    And as a follow-up question, how do I get the font to be larger in the Organizer. It's all so tiny!
    If you are on Windows, you can set the font size  from the control panel, display options. You can set the text font to 125% or 150%.
    That will change the display for other applications too (not for the editor...)

  • HT1926 I have tried to delete the latest itunes and get back to 10.7. Now I have nothing in my library. How do I get the freshly installed itunes 10.7 to sync with the itunes STORE, and get me computers library back?

    I just tried to delete the new itunes (Hate it & could figure out how to sync iphone any more), and I reverted back to itunes 10.7 64-bit. When I tried to use itunes, it couldnt read the library because it had been created by the newer version (why it didn't get deleted when I removed itunes I do not know), so I deleted a few itune library files that I found still on my computer. Now I have the 10.7, but nothing in it... no library items. How do it get the itunes to sync with the itunes store

    This is what you should have done...
    To roll back to iTunes 10.7 first download a copy of the installer from here, uninstall iTunes and suppporting software, i.e. Apple Application Support & Apple Mobile Device Support. Reboot. Restore the pre-upgrade version of your library database as per the diagram below, then install iTunes 10.7.
    See iTunes Folder Watch for a tool to scan the media folder and catch up with any changes made since the backup file was created.
    tt2

  • How to find out the size of a file?

    Hi,
    I would like to determine the size of a file from my code. How is that possible? I do not find any appropriate method in the java.io.File class.
    Any help would be very appreciated!

    java.io.File.length()
    Returns the size of the file as a long. The number corresponds to the number of bytes in the file.

  • How to determine the size of a file on application server

    Hello,
    using open dataset I have created a file on the application server and have put some data into the file.
    Now I want to know the size of this file.
    Is there a function module to do this ?
    Best regards
    Michael

    Hi,
    Use Function module   'EPS_GET_FILE_ATTRIBUTES'
    DATA fsize TYPE epsf-epsfilsiz.
    CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
      EXPORTING
        file_name =     " here provide filename
        dir_name  =    "  here provide directory
      IMPORTING
        file_size = fsize.
    WRITE: 'File size' , fsize.
    Regards,
    Ravi

Maybe you are looking for

  • My apple id is not working apps mostly on imesage

    my apple id is not working apps mostly on imesage

  • (Solved)Help setting up ALSA to mix multiple sources to one output

    Hey everyone, I've been putting off fixing this for a while, since getting the sound working was giving me trouble from the beginning. I'm still a bit of a noob when it comes to configuring ALSA and how the system works in general, so sorry if I miss

  • Remove Anchor Object in the Active document

    I have a couple of InDesign CS4 documents which has Anchor many objects. I just want to remove/delete the entire anchor along with objects through Javascript. Can someone help me out on this regard?

  • Export section of data from ASO

    Is there a way to export only a certain portion of data from an ASO cube? There is an export function in the console, but it exports all level 0 data. For example, I'd like to export just all the January 2007 level 0 data. Thanks!

  • PDF in Flex

    Is it possible to display PDF's inside of Flex web app, NOT Air. I know I can open a new window with JavaScript but I'm not allowed to do that.