How to read compressed data with an applet (mod_deflate)

My applet reads a text file from a web server by opening a socket (see code below). Since the text file is very large, I would like to use apache's mod_deflate. But the web server doesn't seem to recognize the applet as an application where comepressed data can be send to.
How can I convince the web server? Are there any code snippets?
String command = "GET "+name+" HTTP/1.0\n\n";
StringBuffer retval = new StringBuffer();
String buffer;
boolean isBody=false;     
Socket socket = new Socket(host, port);     
OutputStream out = socket.getOutputStream();
out.write(command.getBytes());     
out.flush();
InputStream in = socket.getInputStream();                    
InputStreamReader isr = new InputStreamReader(in);          
BufferedReader bfr = new BufferedReader(isr);
while ((buffer=bfr.readLine())!=null) {
     if (isBody) retval.append(buffer).append("\n");                         
     if (buffer.length()==0) isBody=true;                    
....Thanks in advance

Good hint into the right direction, deflated data arriving now...
.... but how do I inflate them?
import java.net.*;
import java.io.*;
public class Test2 {
    public static void main(String[] args) throws Exception {
        URL def = new URL("http://demo:8090/deftest/data.txt");
        URLConnection defcon = def.openConnection();
        defcon.setRequestProperty("Accept-Encoding", "gzip,deflate");
        BufferedReader in = new BufferedReader(
                                new InputStreamReader(
                                defcon.getInputStream()));
        String inputLine;
        while ((inputLine = in.readLine()) != null)
            System.out.println(inputLine);
        in.close();
}Thanks so far, Dieter

Similar Messages

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to read the data in spectrum analyzer (Anritsu MS2661C) and put it in Excel using Labview

    Hi all, I'm new to using the labview, and I have some trouble doing my project using the labview software.
    I have been trying to use the spectrum analyzer (Anritsu MS2661C) which connect to computer using the GPIB connection.
    I have got the instrument driver which can write and control the instrument using Labview 2010.
    and my Question is how do read the data or result from the spectrum analyzer and send it to the microsoft excel?
    Do I need to use other software or programming to do this step?
    If anyone know how is this done, please let me know.
    Regards,
    Ery

    Hi ery,
    In order to send data that you have read in from an instrument to Excel, the most convenient way to do this would be to use our Report Generation Toolkit.  The Report Generation Toolkit is a very useful tool that allows you to interface to Microsoft Office software from LabVIEW, including Word and Excel.  I am not sure if you are familiar with this, but I have attached a link that explains more about the Report Generation Toolkit below.  
    Another way would be to use the Write To Spreadsheet File VI.  While this will store your data to a spreadsheet data file, it will not allow you to programmatically perform any Excel formatting like the Report Generation Toolkit offers.  I have also attached a link to some information on the Write To Spreadsheet VI below.  
    Also, be sure to check out the Example Finder in LabVIEW for a number of examples on how to write data to a spreadsheet file.  From LabVIEW, you can go to Help»Find Examples to launch the Example Finder.  From there, you can search for "spreadsheet," which should populate examples for use in different applications.  I hope this helps, ery.  Please let me know if you have any further questions about these!
    NI LabVIEW Report Generation Toolkit for Microsoft Office
    Write To Spreadsheet File VI 
    Taylor G.
    Product Support Engineer
    National Instruments
    www.ni.com/support

  • How to validate a date with time

    Hi All,
    How can I validate date with time?
    Here is my code:
    var tempDate:Date = new Date();
    if (tempDate < '09/18/2012 7:30:00 AM'){
         doSomething
    Thanks in advanced

    I think i got it to work.
    var tempDate:Date = new Date();
    var oldDate:Date = new Date('09/18/2012 7:30:00 AM');
    if ( Number(tempDate) < Number(oldDate) ){
         doSomething
    Best,

  • How to read the data in excel sheet

    Dear sir,
    How to read the data in excel sheet when i recieve a data serial communication... ie i have store a data in excel such that
    Cell A       Cell B
       A           Apple 
       B           Ball
       C           Cat
       D           Doll
    when i recieve A from serial communication i have to display Apple, and when i recieve B i have to display Ball and so on.. 

    Hi, 
    I would recommend you to have a look at the VI attached. It makes use of a VI named 'Read from Spreadsheet' to read the row and column data from the tab delimited excel file. The read data is then searched for the Alphabet specified and finally returns you the corresponding string. The test file used to validate the operation of the VI is also attached. 
    Trust this would help you solve the issue. 
    Regards, 
    Sagar G Yadav | Application Engineer | National Instruments
    Attachments:
    read_from_excel.vi ‏10 KB
    Book1.txt ‏1 KB

  • How to read a data from USB port using JAVA

    hi all,
    i need to know how to read a data from USB port using java. any API are available for java ?.........please give your valuable ideas !!!!!!!!!
    Advance Thanks!!

    You can do this. Please use this link
    [http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=uHu&q=java+read+data+from+usb+port&btnG=Search&meta=&aq=f&oq=]
    What research did you do of your own? Have you done some testing application and tried yourself??

  • How to read the date and time information of a file by labview

    how to read the date and time information of a file by labview? for example, created time and modified time.
    Solved!
    Go to Solution.

    if you need to know the last modification date of file:-
    "Functions->File I/O->Advanced File Functions->File/Directory Info.vi"
    This vi returns the value of file's last modification date. This is returned as U32 number. To see it in MM/DD/YY format you must create the indicator, right-click on it and select "Format & Precision" item from drop-down menu. Then select "Time and Date" format there.
    Thanks as kudos only

  • How to read XI Data type in Java code and populate as array list, using UDF

    Hi,
    How to read XI Data type in Java code and populate as array list, using UDF?
    Is there any API using which  the XI data types can be read?
    Kindly reply.
    Richa

    Input Structure:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:CustomerCreateResp xmlns:ns0="urn:bp:xi:up:re:cust_mdm:cmdm:pr5:100">
       <CUSTOMER>
          <item>
             <CUSTOMERNO/>
             <MDMCUSTOMER/>
             <CREATE_DATE/>
             <RETURN>
                <TYPE/>
                <MESSAGE/>
             </RETURN>
             <PT_CONTPART_RETURN>
                <item>
                   <MDM_CONTACT/>
                   <CONTACT/>
                </item>
             </PT_CONTPART_RETURN>
             <PARTNERS>
                <item>
                   <CUSTOMERNO/>
                   <PARTNER_FUNCTION/>
                   <PARTNER_NUMBER/>
                   <DEFAULT_PARTNER/>
                </item>
             </PARTNERS>
          </item>
       </CUSTOMER>
    </ns0:CustomerCreateResp>
    Output structure
    (Sample output structure.This actually needs to be mapped and generated using UDF)
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:updateCustomer xmlns:ns1="urn:xiSericeVi"><ns1:customer><ns2:ArrayList xmlns:ns2="java:sap/standard">[]</ns2:ArrayList></ns1:customer><ns1:name>2344566</ns1:name></ns1:updateCustomer>

  • How to read master data?

    Can anyone tell me the procedure how to read master data?

    Hi,
    I am sorry but your question is a bit vague. What do you mean by your statement? Can you please elaborate your requirement.

  • How to read saved data in BPC 7 Nw Script Logic

    Hi all,
       I am trying to write the logic for Price*Quantity Calculation. This logic should be executed whenever user saves the data for either Quantity or Price.
    For this i created a Implementation on BADI "UJ_CUSTOM_LOGIC". But i am struck on how to read the data from InfoCube ,Like if user saves "Quantity",logic should read "Price" from the cube and calculate the result, Which is equivalent to GET(------) statement in SQL script Logic. Which method should i call to read the saved data in cube.
    Appreciate if someone can help me on this.
    Thanks&Regards,
    Ashok Kumar.

    Hi,
       You can use the LOOKUP instruction like:
    *LOOKUP RATE
    *DIM ENTITY2="DEFAULT"
    *DIM SOURCECURR:INPUTCURRENCY=ENTITY.CURR
    *DIM DESTCURR1:INPUTCURRENCY="USD"
    *DIM DESTCURR2:INPUTCURRENCY="EURO"
    *DIM RATE=ACCOUNT.RATETYPE
    *ENDLOOKUP
    Best regards,
    Mihaela

  • Source read joystick data with visual studio c++

    Can Somebody give me a source for read joystick data with visual studio c++ ???
    PLEASE SOMEBODY HELP ME !!!!!!!!!!!!!!!!!

    https://msdn.microsoft.com/en-us/library/windows/desktop/dd743687%28v=vs.85%29.aspx
    https://msdn.microsoft.com/en-us/library/cc998459.aspx
    https://code.msdn.microsoft.com/windowsdesktop/DirectInput-Samples-8ac6f5e3

  • How to seperate the data with comma seperator ??

    Hi,
      How to seperate the data with comma seperator ??
    E.g i havea row like
    Userid,number of days,Total Records
    user1,10,100000
    So,i will get 10,10000 in the same field and i need to seperate 10 and 10000 so what is the abap function for that
    Praff

    like this ...
    SPLIT field AT ',' INTO
       userid
       days
       records.
    is this what you need?
    Mike

  • How to read the data from a file in another computer with user name and password login

    How to read read the data from a file in anohter computer which need to login with user name and password?

    duplicate post:  http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2061478
    duplicate post:  http://forums.ni.com/t5/LabVIEW/do-need-to-enter-the-user-name-and-password-when-TCP-ip/m-p/2061612
    duplicate post   http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2060682

  • How to read in date/time with ascii import

    I have an ascii data file with a time column in the following format
    ddd hh:nn:ss
    the seconds are like 11.1234567, so it would look like
    234 12:23:11.1234567
    I have tried different format options to read this in
    with no luck. The data I read in I am then using in CLIP/Insight. The video has this time on it and I need it in the data set to be able to sync them up.

    The problem with this data format seems to be the 'ddd' at the beginning of the data format.
    DIAdem expexts the 'dd' to be a day of a month, not a day in a year. I can offer you a solution though:
    Please upload or send me two of your data files and we will create a little script in DIAdem that will import your data format and make it available in DIAdem and DIAdem CLIP.
    You can upload them here in the forum or send them to me at:
    [email protected]
    Please compress the files (with ZIP or similar technology) if they are large.
    Otmar
    Otmar D. Foehner
    Business Development Manager
    DIAdem and Test Data Management
    National Instruments
    Austin, TX - USA
    "For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary."

  • How to read a file with both text and binary data?

    For text data I use a BufferedReader,
    for binary data I use a DataInputStream.
    Since readLine is deprecated in DataInputStream, how can I read in a proper way a file that contains some lines of text followed by some binary data.
    Is there a way to do this without writing a new 'readLine' for DataInputStream (that has to take into account the different newlines for Unix en other OS's)?

    sorry about that ^
    NEW STRING str
    WHILE there is stuff in the file DO
        getByte()
        IF reading a string THEN
            WHILE byte is not a return character DO
                convert the byte to character/string
                append char to str
            WEND
        ELSE IF reading raw data THEN
            parse raw data
            do stuff with it
        END IF
    WEND

Maybe you are looking for

  • Print Only Charts In Report

    In Crystal 10, is there any way to print just the charts of a report without printing the associated and unsuppressed detail?  I have a data-intensive report filled with charts, and a user wants to see the data in the report but only print the charts

  • Updating OS X 10.3.9???

    Hello I am currently running a MAC G5 on OS X 10.3.9 and have just recently bought the iLife 08 upgrade. However the iLife upgrade requires 10.4.9 or later - how do i upgrade onto this version, is it a matter or buying a operating system upgrade or c

  • UPGRADING 23GB AR TABLES TO 11i

    We are upgrading from 10.7 16.1 SC to apps 11i. We have very large tables but the two of most concern are ra_customer_trx_Lines_all 22GB 50 million rows ra_cust_trx_line_gl_dist_all 13GB 90 million rows. Has anyone else upgraded a large AR installati

  • TS3297 THE APPSTORE PAGE IS FROZEN WITH DROPBOX ADVERTISING ON TOP OF PAGE

    THE IPAD APPSTORE PAGE IS FROZEN WITH DROPBOX ADVERTISING ON TOP OF APP BUTTONS

  • Safari (and Skype) began to crash constantly without visible reason today

    Today I found suddenly Safari, Skype and Mail crashed on my computer (was not in front of computer in this moment). Since then Safari (and Skype) began to constantly crash shortly (couple of seconds) after loading home page. No new installations had