× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Since no one has replied, here is something to get you started -- not
tested. I know there are some limitations and bugs in the zip support
for Java so you might do some research the bug parade issues. I read
about the bugs and saw a work around in Tomcat's code base but I am not
sure if it is fixed or not. There is a filter that comes with Tomcat for
compressing the output stream sent to a browser that you may be able to
learn from.

package com.plumcreek.test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;


public class Zipper {
    public static void main(String[] argv) {
        // create some objects
        try {
            String test = new String(
                   
"aaaaaaabbbbbbbcccccccaaaaaaabbbbbbbcccccccaaaaaaabbbbbbbcccccccaaaaaaabbbbbbbccccccc");
            byte[] before = test.getBytes();

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            GZIPOutputStream gzos = new GZIPOutputStream(baos);
            ObjectOutputStream oos = new ObjectOutputStream(gzos);
            oos.writeObject(test);
            oos.flush();
            oos.close();

            byte[] after = baos.toByteArray();
            baos.close();

            ByteArrayInputStream bais = new
ByteArrayInputStream(after);
            GZIPInputStream gs = new GZIPInputStream(bais);
            ObjectInputStream ois = new ObjectInputStream(gs);
            String decompressed = (String) ois.readObject();
            ois.close();
            bais.close();
            
            System.out.println(decompressed);
            
        } catch (Exception e) {
            System.err.println(e.getLocalizedMessage());
            e.printStackTrace(System.err);
        }
    }
}


>>> mtanveer@xxxxxxxxxxxxxxxxxx 1/14/2004 9:57:02 AM >>>
Ok what I want to do is this I have a file "FILEA" with following
format.  I
want to read FILEA and write the whole record from FILEA in one field
of
FILEB.  Is it possible to compress the FILEA data before writing to
FILEB?

FileA
Format       Fields   Length
COHDRR           87      579

FileB
Format       Fields   Length
COHDRR           1      variable length


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.