GZIP with kXML?

I've got a problem, because I'd like to use GZIP with:
http://www.tinyline.com/utils/index.html
which gives me String of data.
After data's unzipped I'd like to parse it by Pull-parsing kXML, but...
kXML needs InputStream to initialize and I've got String from GZIP. Is that possible to change String into InputStream or initialize kXML with String?
please help..

Hi !
I am using following code to do that in my project, It might help you..
   String message = "your String" ;
            ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes());
            InputStreamReader isr = new InputStreamReader(bais);
            XmlPullParser pp = new KXmlParser();
            pp.setInput(isr);-Jestan

Similar Messages

  • Gzip with servlet

    Hi,
    I am facing a problem with servlet which compresses the MS Excel files in gzip format,
    when i try opening the Template.gz file using winzip or gzip.exe,it throws me an error as either " invalid zip file" or " archive directory not valid"
    Can someone pls help in resolving this porblem,
    Its very very urgent for me to solve this problem,
    My servlet code snippest is as below,
    I am using Microsoft Internet Explorer 6.0 to download template.gz file which supports gzip and deflate formats,
    --------TemplateGenerator.java-----------------
    public void doPost(HttpServletRequest req, HttpServletResponse res)
    String encodings = req.getHeader("Accept-Encoding");
    System.out.println(encodings);
    res.setHeader("Content-Encoding", "gzip");
    res.setHeader("Content-Disposition", "attachment;filename=Templates.gz");
    try{
    //First create User directory
    String dir = "C:/";
    String separator = System.getProperty("file.separator");
    //Read the files in the current directory and write to zip file
    GZIPOutputStream zip = new GZIPOutputStream(res.getOutputStream());
    File dir1 = new File(dir);
    File[] list = dir1.listFiles();
    if(list == null)
    System.out.println("No files");
    else
    for(int k=0;k < list.length; k++)
                                       int filelen = (int)list[k].length();
                                       System.out.println("File Length :"+filelen);
                                       FileInputStream fis = new FileInputStream (list[k]);
                                       byte[] tempfile = new byte[filelen];
                                       int bytesRead = fis.read( tempfile,0,filelen );
                                       // checking bytesRead not shown.
                                       fis.close();
                                       // write the contents into the zip element
                                       zip.write( tempfile , 0, filelen );
                                       zip.finish();
    // close the entire zip
    zip.flush();
    zip.close();
    -------------------------------------------------

    Hi !
    I am using following code to do that in my project, It might help you..
       String message = "your String" ;
                ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes());
                InputStreamReader isr = new InputStreamReader(bais);
                XmlPullParser pp = new KXmlParser();
                pp.setInput(isr);-Jestan

  • Is it possible to implement compression like gzip with the labview web server?

    I am currently implementing a web page to be served by the NI sbRIO 9636.  I was able to get html, css, and js served just fine.  I am curious if there is a way to implement gzip compression to help with page load times?
    Solved!
    Go to Solution.

    Ok, a couple points:
    I have heard it discussed that you can in theory install a webserver on the Linux-based cRIO. But there is a great big caveat: I have never done it, or spoken to anyone who did so I don't know how well it would actually work.
    Given the inexpensive price of hardware these days a safer alternative would be to include a separate computer the sole function of which is to host the web interface. There are many small computers that would be ideal for this application -- many of which were originally designed to work in home-theater applications.
    The point of my post was that there are certain limitations in the LV webserver that you may have to find your way around.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • XML sending to Mobile Device with KXML + Bluetooth

    Dir Madame,
    Dir Sir ;-)
    I am using a N73, WTK22, EcipseME and KXML 2.3.0. I initalized a Bluetooth Connection between my mobile and my desktop application. So far, so well.
    It is possible to send simple String-Messages to my mobile device via DataOutputStream (dos) / DataInputStream (dis).
    dos.writeUTF("Hello Nokia Forum"); //ServerSide (=Desktop)
    print(dis.readUTF()); //prints "Hello Nokia Forum" on my Display. - ClientSide (=Mobile)
    But.. for sure, i need to send XML messages. Therefore, i send a XML File byte for byte from my desktop application to the mobile like this:
    boolean read = true;
         while (read) {
         byte b = dis.readByte();
         System.out.println(b);
         dos.write(b);
    catch(java.io.EOFException es){end of file reached..}
    If i print the bytes which are written to the outputStream (from desktop), for example, i get
    60
    63
    120
    109
    if i read them, on the client side, i get the same!
    60
    63
    120
    109
    - So, everything looks fine. But if i stop reading them out on the Client Side, and give the InputStream the XML Parser, i get an org.xmlpull.v1.XmlPullParserException
    Reader reader = new InputStreamReader(serverInputStream);
    KXmlParser parser = new KXmlParser();
    parser.setInput(reader);
    parser.nextTag(); //PullParserException..
    If i test my Code with
    InputStream in = new FileInputStream(url);
    where "url" is my XML file, KXML parses this direct InputStream. But if i read this InputStream and send it byte for byte to my mobile - KXML cannot read this..
    any ideas?

    Hi,
    As u told kXML can be used for devices like 6630 nokia. so i downloaded the jsr files of xml.plz tell me how to use kxml to make a xml file from a text file consisting of text and data residing on the device and send to the server to process it..for the time being tell me how to use kxml...any good documentation abt its usage in Netbeans IDE 6.1...
    regards,
    sanjay

  • Replace bzip2 and gzip with pbzip2 and pigz system wide?

    I just now got word of these multithreaded ports and would like to know if theres anyway to replace their single threaded brethren? pigz is already in AUR and it wouldn't take much to put pbzip2 into it either.
    Maybe some global variable should be set?
    Edit: Strike the part about pbzip2. It's already in community
    Last edited by uncholowapo (2010-10-10 23:48:04)

    karol wrote:One thing you may want to check: if you compress a file w/ pbzip2 and send it over to me, will I be able to uncompress it with bzip2?
    I just did some testing by downloading the Linux kernel source, and then using bzip2 and pbzip2 to decompress and recompress it several times.  In another terminal window I monitored the speed of each CPU core by running:
    watch 'cat /proc/cpuinfo | grep MHz'
    What I found out was that yes, the files created by either tool will be able to be decompressed with the other.  However, if you use pbzip2 to decompress a file compressed with the regular bzip2, it will only use one core.  Only when decompressing a file that was compressed with pbzip2 did pbzip2 use both CPU cores.

  • Uusing gzip with ALUI 6.1

    I have a vanilla portal that I would like to perform some benchmarking on and I have been unable to find any documentation that describes how to enable gzip to compress components in the portal.
    My environment is ALUI 6.1 MP1, WebLogic Server 9.2, and Oracle 10g database.
    Can anyone point me in the right direction?
    Thank you,

    i think you want to look into mod_deflate for apache.
    basically the compression is done by the app server, not WCI.

  • Gzip with --rsyncable

    Hey guys
    I'm in need of the --rsyncable option in gzip but apparently its been dropped in the latest versions. I've been using it in previous distros because of the decreased rsync'ing time.
    I've done a bit of searching but I'm not finding where the upstream dev work on gzip gets organised.
    Can someone point me in the right direction?
    Or is there anyone who knows how to get the option back?

    The patch doesnt' seem to work.
    patching file deflate.c
    Hunk #8 FAILED at 687.
    1 out of 10 hunks FAILED -- saving rejects to file deflate.c.rej
    patching file gzip.c
    patching file gzip.h
    Hunk #2 FAILED at 283.
    1 out of 2 hunks FAILED -- saving rejects to file gzip.h.rej
    patching file trees.c
    This also happens after specifically *not* applying the other patch mentioned in the PKGBUILD, gzip-fixutimens.patch.
    I'll give it another bash in the morning. I might be doing something silly and I need some sleep.
    Thanks phrakture

  • How can i use GZip combined with NIO?

    Hi All,
    I have a nio client that connects a client (HTTP) and request something. I need my client to Accept-Encoding: gzip - but how will i be able to read the data into my ByteBuffer?
    I don't have a problem reading, cause it's bytes after all, but i will have a problem (i guess) determining when the reading is complete - when it finished. If i'm reading HTTP, for instance, i know i should finish reading after receiving \r\n\r\n. How should i do it for gzip info?
    Thanks,
    Snayit

    When i'm reading the HTTP i receive Content-Length X but actualy is sends the X with Y bytes (i guess it's a key, about to check in the API).
    Is there a way to combine the GZip with NIO?

  • Missing Images Grey Box with ?

    Have tried drills to view inserted images in 4-page Pages doc, going thru Finder to view, reinsertion of images, trashed com.apple.iwork.Pages.plist,,reinstalled iworks '05 CD, upgraded to 1.0.2, read copious discussions from gurus, still no joy. Images I inserted still there, elusive as ever which remain hidden with that ugly "X" and "?" when reopening doc. Am Mac addict from day one, average Mac user, not tech guru, programmer, developer but need step by step instruction for my low-level 83-year-old comprehension. Pages works o.k. with glitches but the missing image grey box with X and ? reared its ugly head last April and still with me on occasion. Finish 4-page Pages monthly Newsletter 5 meg doc with about 15 inserted jpeg images, "save as" for local distribution printing plus "pdf" for e-mail transmission, print it but when reopening doc after closing I get the grey box with X and ? for my inserted images and have to start over. Images I inserted originally still there opening thru Fiinder viewing "Package Content". Ran G5 Hardware CD test, no problem. From discussions I noted one solution that worked by uncompressing "index.xml.gz" file. Tried that with Stuffitt which didn't work. Am unable to view to see if my images were corrupted as the Discussion Guru "Sylvain Pedneault" outlined on Sep 15, 05, that his images had property sf:corrupt="true". Could be that's my problem if I knew how to determine and fix. I've hit a firewall and am patiently waiting for Apple Pages gurus to resolve this issue still unresolved which I'm confident they will, but at my age I don't buy green bananas. My frustration level is maxed out and will appreciate help in simple step by step language as a work-around until Apple Pages comes thru with upgrade. If I make it thru the Pearly Gates, not guaranteed, I'll put in a good word for the Guru who can resolve my problem!! Thanks.

    Hello Jim,
    If you want to uncompress a "index.xml.gz" file, try this way:
    a) Copy the "index.xml.gz" file to your desktop, so you are not working with the original file.
    b) Start from "Applications/Utilities" the program "Terminal".
    c) In the terminal window, type: gunzip (with a space after it).
    d) Grap the "index.xml.gz" file from the dektop and drop it over the terminal window.
    e) Hit the return key.
    Now you have a "index.xml" file, which you can open with a text editor.
    To compress the file, do the following:
    a) In the terminal window. type: gzip (with a space after it).
    b) Grap the "index.xml" file from the dektop and drop it over the terminal window.
    c) Hit the return key.
    The file should be compressed.
    To make the template readable for Pages, do the following:
    a) Copy the original "index.xml.gz" file from the template package folder (not to the desktop) to have a backup.
    b) Now copy the "index.xml.gz" file from the desktop (the one you have edited) to the template package folder and overwrite the original.
    Please let us know, what you find out.
    Frank.

  • GZIP and External command.

    Hello,
    My problem might seem simple but I have tried for a couple of days now to make researches on that matter and it still doesn't work, no matter what.
    I had to make, with SM69, two external commands. One was using the command "mv" which is working very well and the other must be a "gzip" with a parameter "-c" and, in a module function, with the function "SXPG_COMMAND_EXECUTE_LONG", I have to send the path and the file name.
    So since I am not able to make it work in the module function I'm creating, I am working to make it work on SM69. So here what I have entered so far...
    Operating System Command: gzip
    Parameters for operating sytem command: -c
    Additional parameters: path/file.txt > newpath/file.txt.gz
    Though, the only thing I am receiving is no change at all and I'm receiving  u2039  È ®J as a message. The Exit code is at 1 and the exit status is E.
    I know it means there is something wrong but all my researches lead me to do it that way so I'm not sure where I am going wrong and how to make it work appropriately.
    Can you please help me?
    I am open to questions if you have any.
    Thank you

    Hi, kindly check the following  example
    Command name : ZTEST
    Operating system command : cmd /c
    v_dir_input = 'cmd /c c:\winzip\wzzip.exe -password  g:\test1.zip g:\test.pdf'.
    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
      EXPORTING
        commandname                   = c_extcom
        additional_parameters         = v_dir_input
        operatingsystem               = c_oper
      TABLES
        exec_protocol                 = t_result
      EXCEPTIONS
        no_permission                 = 1
        command_not_found             = 2
        parameters_too_long           = 3
        security_risk                 = 4
        wrong_check_call_interface    = 5
        program_start_error           = 6
        program_termination_error     = 7
        x_error                       = 8
        parameter_expected            = 9
        too_many_parameters           = 10
        illegal_command               = 11
        wrong_asynchronous_parameters = 12
        cant_enq_tbtco_entry          = 13
        jobcount_generation_error     = 14
        OTHERS                        = 15.

  • Configuring GZip for OracleAS Portal

    How do you configure gzip with OracleAS portal.
    Currently i have added the gzip jar file in my application, and configured the same through the Web.xml file as
    <filter>
    <filter-name>Compress</filter-name>
    <filter-class>com.appln.GZIPFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>Compress</filter-name>
    <url-pattern>/portal</url-pattern>
    </filter-mapping>
    However the GZipFilter class is not getting invoked.
    I think the problem is the the way the url-pattern is written.
    Can someone please tell me how could this be written, so that the gzip utility is activated.
    Regards,
    Mukta

    How do you configure gzip with OracleAS portal.
    Currently i have added the gzip jar file in my application, and configured the same through the Web.xml file as
    <filter>
    <filter-name>Compress</filter-name>
    <filter-class>com.appln.GZIPFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>Compress</filter-name>
    <url-pattern>/portal</url-pattern>
    </filter-mapping>
    However the GZipFilter class is not getting invoked.
    I think the problem is the the way the url-pattern is written.
    Can someone please tell me how could this be written, so that the gzip utility is activated.
    Regards,
    Mukta

  • Writing xml file, midp, kxml - any ideas?

    Hello,
    Does any have sample code of writing an XML file with kXML or a similar tool?
    I'm getting confused with OutputWriter being abstract/DataOutputWriters not working.
    My code as follows is fairly non-existent..
    OutputStream out = "test.xml"; // this errors with incompatible type (obviously) but what needs to go here?
    XmlWriter fxml = new XmlWriter(out);
    thanks in advance
    poncenby

    OutputStream out = "test.xml"this cant work. the latter is a string and the former an OutputStream.
    yeah, thats pretty strange with the input and output of kXML. What you have to do is:
    1) write a class, that extends the java.io.OutputStream. To do this, you have to implement all abstract methods of this (afaik write(byte))
    2) this class can you pass to the XmlWriter. The most simple way of writing the bytes is to append it to a string, which you reference afterwards.
    public class MyOutputStream extends OutputStream
    public String output = "";
    public void write(int b)
      output += (char)b;
    }then write the stuff out and get the output of your OutputStream class. For writing this to a file (whichis not possible with J2ME, you have to some file handling in your OutputStream, like opening, appending and closing)
    Note: this works only, if the content consists of characters. If you want to write binary data, this will get corrupt, since the cast to char transforms this binaries to characters. The reverse is (afaik) not possible.
    hth
    Kay

  • Mutt with qzip patch

    Hey guys,
    I'd like to use gzip with mutt.
    I've only tried applying a patch with a PKGBUILD a couple of times, and never did get the hang of it. 
    Here is the PKGBUILD, and here is the patch.
    Little help, please?  :-)

    Thanks. 
    I thought of that, and even tried it--but I had some problems converting my mutt config to muttng.  There's a perl conversion script floating around somewhere, but it didn't do anything that I could tell.  If no one has a magic wand they can wave over my .muttrc and .mutt/ directory, I'll look at the muttng PKGBUILD for patching hints.
    magic wand?  anyone?

  • Database backup on tape

    Hi All,
    I am trying to backup the database using tar command on tape storage.
    server is sun solaris and tape storage is LTO4 (1.7TB)
    I want to tar with zip directly to the tape but couldn't find any option in solaris to zip with tar like we are having ( tar -cvzf in linux).
    could anyone please guide me how to achieve that?
    if i have to use unix PIPE (|) with the tar command to take it directly to tape then what should be the command?
    Thanks

    First of all I didn't see you writing you did shutdown the database before backups are made.
    Make sure the database is shutdown, or you backups are totally useless !!!
    The default UNIX tar as installed on Sun and e.g. AIX doesn't support instant compressing by calling gzip with the -z option.
    Take a look at http://www.gnu.org or even better at: http://www.sunfreeware.com and download the GNU tar
    Install it on your server, usually it will be installed in /usr/local/bin. Use that tar command for your backup as it does support the -z option.
    Make sure 'gzip' is in your search PATH
    On the other hand I am wondering why you would gzip the database file before putting them on tape.
    Is it to save tape storage ??
    Nowadays tape devices have their own hardware compression, making to unnecessary to compress the files on forehand.

  • Timeline color missing (no grey at every 5)

    Somehow, my timeline is all white now. I'm missing the tinted
    frame box coloring at ever 5 frames. This made it easy to see what
    frame I was clicking on.
    Does anyone know where the setting is located to turn the
    every 5 frames shading back on? (Version 9.0)

    Hello Jim,
    If you want to uncompress a "index.xml.gz" file, try this way:
    a) Copy the "index.xml.gz" file to your desktop, so you are not working with the original file.
    b) Start from "Applications/Utilities" the program "Terminal".
    c) In the terminal window, type: gunzip (with a space after it).
    d) Grap the "index.xml.gz" file from the dektop and drop it over the terminal window.
    e) Hit the return key.
    Now you have a "index.xml" file, which you can open with a text editor.
    To compress the file, do the following:
    a) In the terminal window. type: gzip (with a space after it).
    b) Grap the "index.xml" file from the dektop and drop it over the terminal window.
    c) Hit the return key.
    The file should be compressed.
    To make the template readable for Pages, do the following:
    a) Copy the original "index.xml.gz" file from the template package folder (not to the desktop) to have a backup.
    b) Now copy the "index.xml.gz" file from the desktop (the one you have edited) to the template package folder and overwrite the original.
    Please let us know, what you find out.
    Frank.

Maybe you are looking for

  • Final Cut Studio interface uniformity

    I have a problem with two UI's in Final Cut Studio. Interfaces which compete with program material draw away from creative processes IMHO. My main concern is that the brushed-aluminum (or titanium) interface in FCP and Motion visually disrupts my vie

  • Attaching a document to an email

    How can I attach a document or a photo to an email I am sending? Message was edited by: jfioramo

  • Where is the brush tool associated with tablets gone to in CS6?

    I have a problem right now. Do you know that icon which is next to the brush size icon once you select the brush tool? That icon once you insert a drawing tablet in so that your drawings can be better with how much pressure you put into it? I forgot

  • Any idea why I'm seeing inconsistent results using the find function?

    I and a colleague of mine both have Adobe Standard X and are both looking at exactly the same PDF file.  When I search for a word in the file (right click, find) I can find words no problem.  My colleague does the same thing with the same document an

  • Restore Database .ndf files

    I have a backup (.BAK file) which has bunch of .ndf files. I want to restore it on a database which has only .mdf and .ldf files. How to restore it? I am new to Sql server 2008 R2 and never restored .bak file which contains .ndf files... Thanks in ad