.cab格式的文件包中有一个.txt格式的文件,如何用户JAVA代码解压缩出来啊?谢谢!

解决方案 »

  1.   

    try this method.
    it accept a relative path to the resource, no matter if its in a cab or not.
    something likegetResouece("/package/1.txt");and return you a DataInputStream.
    you can the use the data input stream readLine method to get what you need.public DataInputStream getResource(String full_resource_name) throws java.io.IOException
            {                InputStream is = getClass().getResourceAsStream(full_resource_name);
                    if(is == null)
                          throw new IOException("Unable to resolve resource name " + full_resource_name + " (file not found)");                BufferedInputStream bis = new BufferedInputStream(is);
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    byte[] buff = new byte[4096];                int len;
                    byte[] data =null;                while ((len = bis.read(buff)) != -1)
                    {
                            baos.write(buff, 0, len);
                    }                data = baos.toByteArray();
                    return new DataInputStream(new java.io.ByteArrayInputStream(data));
            }
      

  2.   

    com.ms.util.cabMS以前有这么个包,你看还能不能找到。