Open file  with extension is .Z

I need open file xxxx.Z for read its content.
I looker for in java.uitl.zip and classes Zip and GZIP aren't useful.

as jholdstock reply has error,I already correct this problem.
in my job,I don't want to uncompress file ,but I'want to read this data file so I also add
method readLine() to this class .
* @(#)UncompressInputStream.java 0.3-2 18/06/1999
* This file is part of the HTTPClient package
* Copyright (C) 1996-1999 Ronald Tschal?r
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA
* For questions, suggestions, bug-reports, enhancement-requests etc.
* I may be contacted at:
* [email protected]
* correct something and add readLine() by [email protected]
//package HTTPClient;
import java.io.IOException;
import java.io.EOFException;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.FilterInputStream;
* This class decompresses an input stream containing data compressed with
* the unix "compress" utility (LZC, a LZW variant). This code is based
* heavily on the <var>unlzw.c</var> code in <var>gzip-1.2.4</var> (written
* by Peter Jannesen) and the original compress code.
* @version 0.3-2 18/06/1999
* @author Ronald Tschal?r
public class UncompressInputStream extends FilterInputStream {
* @param is the input stream to decompress
* @exception IOException if the header is malformed
public UncompressInputStream(InputStream is) throws IOException{
     super(is);
     parse_header();
byte[] one = new byte[1];
public synchronized int read() throws IOException{
     int b = in.read(one, 0, 1);
     if (b == 1) return (one[0] & 0xff);
     else return -1;
// string table stuff
private static final int TBL_CLEAR = 0x100;
private static final int TBL_FIRST = TBL_CLEAR + 1;
private int[] tab_prefix;
private byte[] tab_suffix;
private int[] zeros = new int[256];
private byte[] stack;
// various state
private boolean block_mode;
private int n_bits;
private int maxbits;
private int maxmaxcode;
private int maxcode;
private int bitmask;
private int oldcode;
private byte finchar;
private int stackp;
private int free_ent;
// input buffer
private byte[] data = new byte[10000];
private int bit_pos = 0, end = 0, got = 0;
private boolean eof = false;
private static final int EXTRA = 64;
public synchronized int read(byte[] buf, int off, int len) throws IOException {
     if (eof) return -1;
     int start = off;
     /* Using local copies of various variables speeds things up by as much as 30% ! */
     int[] l_tab_prefix = tab_prefix;
     byte[] l_tab_suffix = tab_suffix;
     byte[] l_stack = stack;
     int l_n_bits = n_bits;
     int l_maxcode = maxcode;
     int l_maxmaxcode = maxmaxcode;
     int l_bitmask = bitmask;
     int l_oldcode = oldcode;
     byte l_finchar = finchar;
     int l_stackp = stackp;
     int l_free_ent = free_ent;
     byte[] l_data = data;
     int l_bit_pos = bit_pos;
     // empty stack if stuff still left
     int s_size = l_stack.length - l_stackp;
     if (s_size > 0){
          int num = (s_size >= len) ? len : s_size ;
          System.arraycopy(l_stack, l_stackp, buf, off, num);
          off += num;
          len -= num;
          l_stackp += num;
          }//if (s_size > 0)
     if (len == 0){
          stackp = l_stackp;
          return off-start;
          }//if (len == 0)
// loop, filling local buffer until enough data has been decompressed
     main_loop: do{
          if (end < EXTRA) fill();
          int bit_in = (got > 0) ? (end - end%l_n_bits)<<3 : (end<<3)-(l_n_bits-1);
          while (l_bit_pos < bit_in){
          // check for code-width expansion
               if (l_free_ent > l_maxcode){
                    int n_bytes = l_n_bits << 3;
                    l_bit_pos = (l_bit_pos-1) +
                    n_bytes - (l_bit_pos-1+n_bytes) % n_bytes;
                    l_n_bits++;
                    l_maxcode = (l_n_bits==maxbits) ? l_maxmaxcode : (1<<l_n_bits) - 1;
                    if (debug) System.err.println("Code-width expanded to " + l_n_bits);
                    l_bitmask = (1<<l_n_bits)-1;
                    l_bit_pos = resetbuf(l_bit_pos);
                    continue main_loop;
                    }//if (l_free_ent > l_maxcode)
               // read next code
               int pos = l_bit_pos>>3;
               int code = (((l_data[pos]&0xFF) | ((l_data[pos+1]&0xFF)<<8) | ((l_data[pos+2]&0xFF)<<16)) >> (l_bit_pos & 0x7)) & l_bitmask;
               l_bit_pos += l_n_bits;
               // handle first iteration
               if (l_oldcode == -1){
                    if (code >= 256){  throw new IOException("corrupt input: " + code + " > 255"); }
                    l_finchar = (byte) (l_oldcode = code);
                    buf[off++] = l_finchar;
                    len--;
                    continue;
                    }//if (l_oldcode == -1)
               // handle CLEAR code
               if (code == TBL_CLEAR && block_mode){
                    System.arraycopy(zeros, 0, l_tab_prefix, 0, zeros.length);
                    l_free_ent = TBL_FIRST - 1;
                    int n_bytes = l_n_bits << 3;
                    l_bit_pos = (l_bit_pos-1) +
                    n_bytes - (l_bit_pos-1+n_bytes) % n_bytes;
                    l_n_bits = INIT_BITS;
                    l_maxcode = (1 << l_n_bits) - 1;
                    l_bitmask = l_maxcode;
                    if (debug) System.err.println("Code tables reset");
                    l_bit_pos = resetbuf(l_bit_pos);
                    continue main_loop;
                    }//if (code == TBL_CLEAR && block_mode)
               // setup
               int incode = code;
               l_stackp = l_stack.length;
               // Handle KwK case
               if (code >= l_free_ent){
                    if (code > l_free_ent) throw new IOException("corrupt input: code=" + code + ", free_ent=" + l_free_ent);
                    l_stack[ --l_stackp ] = l_finchar;
                    code = l_oldcode;
                    }//if (code >= l_free_ent)
               // Generate output characters in reverse order
               while (code >= 256){
                         l_stack[--l_stackp] = l_tab_suffix;//xxxx
                         code = l_tab_prefix;
                         }//while(code >= 256 )
               l_finchar = l_tab_suffix;
               buf[off++] = l_finchar;
               len--;          // And put them out in forward order          
               s_size = l_stack.length - l_stackp;
               int num = (s_size >= len) ? len : s_size ;
               System.arraycopy(l_stack, l_stackp, buf, off, num);
               off += num;
               len -= num;
               l_stackp += num;     // generate new entry in table
               if (l_free_ent < l_maxmaxcode){
                    l_tab_prefix[l_free_ent] = l_oldcode;        
                    l_tab_suffix[l_free_ent] = l_finchar;        
                    l_free_ent++;
                    }//if(l_free_ent < l_maxmaxcode)          // Remember previous code          
               l_oldcode = incode;          // if output buffer full, then return          
               if (len == 0){   
                    n_bits   = l_n_bits;             
                    maxcode  = l_maxcode;             
                    bitmask  = l_bitmask;             
                    oldcode  = l_oldcode;             
                    finchar  = l_finchar;             
                    stackp   = l_stackp;             
                    free_ent = l_free_ent;             
                    bit_pos  = l_bit_pos;             
                    return off-start;          
                    }//if(len == 0 )
               }//while (l_bit_pos < bit_in)
               l_bit_pos = resetbuf(l_bit_pos);
          } //main_loop: do
     while (got > 0);
     n_bits   = l_n_bits;     
     maxcode  = l_maxcode;     
     bitmask  = l_bitmask;     
     oldcode  = l_oldcode;     
     finchar  = l_finchar;     
     stackp   = l_stackp;     
     free_ent = l_free_ent;     
     bit_pos  = l_bit_pos;     
     eof = true;     
     return off-start;   
     /**     * Moves the unread data in the buffer to the beginning and resets     * the pointers.     */   
     private final int resetbuf(int bit_pos)    {     
          int pos = bit_pos >> 3;     
          System.arraycopy(data, pos, data, 0, end-pos);     end -= pos;     return 0;   
     private final void fill()  throws IOException    {     
          got = in.read(data, end, data.length-1-end);     
          if (got > 0)  end += got;   
     public synchronized long skip(long num)  throws IOException    {     
          byte[] tmp = new byte[(int) num];     
          int got = read(tmp, 0, (int) num);     
          if (got > 0) return (long) got;     
          else         return 0L;   
     public synchronized int available()  throws IOException    {     
          if (eof)  return 0;     
          return in.available();   
     private static final int LZW_MAGIC = 0x1f9d;   
     private static final int MAX_BITS = 16;   
     private static final int INIT_BITS          = 9;   
     private static final int HDR_MAXBITS      = 0x1f;   
     private static final int HDR_EXTENDED     = 0x20;   
     private static final int HDR_FREE          = 0x40;   
     private static final int HDR_BLOCK_MODE     = 0x80;   
     private void parse_header()  throws IOException    {     
          // read in and check magic number      
          int t = in.read();
          if (t < 0)  throw new EOFException("Failed to read magic number");
          int magic = (t & 0xff) << 8;
          t = in.read();
          if (t < 0)  throw new EOFException("Failed to read magic number");
          magic += t & 0xff;
          if (magic != LZW_MAGIC)     throw new IOException("Input not in compress format (read " + "magic number 0x" + Integer.toHexString(magic) + ")");     // read in header byte
          int header = in.read();     if (header < 0)  throw new EOFException("Failed to read header");
          block_mode = (header & HDR_BLOCK_MODE) > 0;
          maxbits    = header & HDR_MAXBITS;
          if (maxbits > MAX_BITS)         throw new IOException("Stream compressed with " + maxbits + " bits, but can only handle " + MAX_BITS + " bits");     
          if ((header & HDR_EXTENDED) > 0)         throw new IOException("Header extension bit set");     
          if ((header & HDR_FREE) > 0)         throw new IOException("Header bit 6 set");
          if (debug)     {         System.err.println("block mode: " + block_mode);         System.err.println("max bits:   " + maxbits);     }
          // initialize stuff
          maxmaxcode = 1 << maxbits;     
          n_bits     = INIT_BITS;     
          maxcode    = (1 << n_bits) - 1;     
          bitmask    = maxcode;     oldcode    = -1;     
          finchar    = 0;     
          free_ent   = block_mode ? TBL_FIRST : 256;     
          tab_prefix = new int[1 << maxbits];     
          tab_suffix = new byte[1 << maxbits];     
          stack      = new byte[1 << maxbits];     
          stackp     = stack.length;     
          for (int idx=255; idx>=0; idx--)         tab_suffix[idx] = (byte) idx;   
          }//private void parse_header()  throws IOException   
     public String current_str="";
     public String buf_str="";
     public int start_pos=0;
     public String readLine()  throws IOException {
          int find_pos=current_str.indexOf("\n",start_pos);
          while( find_pos < 0 ){
               byte[] buf = new byte[1000];
               buf_str=current_str.substring(start_pos);
               start_pos=0;
               int got=0;
               got=read(buf);
               if(got < 0) {  return null; }
               current_str=buf_str + new String(buf,0,got);
               find_pos=current_str.indexOf("\n",start_pos);
               }//while
          find_pos=current_str.indexOf("\n",start_pos);
          String ret_str=current_str.substring(start_pos,find_pos);
          start_pos=find_pos+1;
          return ret_str;
     private static final boolean debug = false;   
     public static void main (String args[])  throws Exception    {     
          if (args.length != 1)     {         System.err.println("Usage: UncompressInputStream <file>");         System.exit(1);     }     
          //InputStream in = new UncompressInputStream(new FileInputStream(args[0]));     
          UncompressInputStream in = null ;
          try { in = new UncompressInputStream(new FileInputStream(args[0])); }
          catch ( Exception e) {System.out.println(e.toString() );  System.exit(-1); }
          long beg = System.currentTimeMillis();     
          String tt;
          int i=0;
          try {
               while(true){
                    tt=in.readLine();
                    if(tt==null) break;
                    System.out.println( tt);
                    i++;
          catch(Exception e){System.out.println(e.toString()); }
          long end = System.currentTimeMillis();     
          System.err.println("Time: " + (end-beg)/1000. + " seconds");

Similar Messages

  • Preview program stoped to open files with extension .JPG

    When open the files with the extension ".jpg" Preview program opens a gray window and everything, but in the information window shows the photo. In what could be the problem?

    anything that is intermittent - and thus, non-reproducable - is a nightmare to troubleshoot and fix. From what little evidence there is, I would almost think of some third factor - other software? - that may be in play. maybe someone with more expertise can help...
    I see that your Question has languished for some period of time without response. You have posted your issue in Using Apple Support Communities whose topic is 'How to use this forum software's interface, features and/or how to find what you wish'. It is a relatively low traffic and inappropriate forum for your problem. I will ask our Hosts to move it to " OS X Yosemite " where it may get a more rapid response from your fellow users.
    ÇÇÇ

  • Xdg-open is opening files with no extension in wine notepad

    xdg-open is opening files with no extension in wine notepad. This is really annoying. How can I change it?

    Click on "Browse" button at the "Open With" dialog and navigate to the location, where acrord32.exe is located. Preferebly, it should be this location "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe" unless you have installed at some customized location.  I'm assuming you have installed Reader 9. Once you add Adobe Reader in the open with list, it would continue to appear next time onwards.

  • Where do you select which program you want to open files with a particular extension?

    Where do you go to select which program should open files with particular extensions?

    if you right click on the file and select get info, a window will open. Click on the "open with" and the window will expand. There you can select which application you want that document to open with. If you want to open ALL documents of that type with a specific application click the change all button.

  • Opening files with .asp extension

    Since few weeks I am not able to open files with .asp extension.
    There was no problem over a long time, maybe the issue started with the actualization of OS X, moving to OS X 10.6.5 or with the actualization of Safari, moving to 5.0.3.
    Please let me know what I can do to re-open .asp files.
    Thanks

    Hallo Everybody, I have a similar issue.
    I run a Macbook Pro, and I operate into an internet based ERP system (managed by microsoft machines)
    In this system, which completely works through internet, I can create orders, invoices, then I tap "create invoice" and get a pdf file.
    Till few weeks ago it worked smoothly: I tapped "create invoice", the system worked and few seconds later adobe reader opened showing me the file from a .asp document. Now it doesn't work anymore.
    If I tap "create invoice", adobe reader doesn't do anything, but the .asp file is created into the "download" folder with the name "print preview", so I have to go into that folder and manually open the file.
    This leads in a waste of time and some confusion if I issue many documents at a time, which I find all mixes up with names "print preview 1" - 2 - 3...
    Does anybody have a clue on how I can open the .asp files into adobe reader automatically as they are created?
    Thank you in advance

  • When a file with extension .htm as a product from Epilex is opened, there was a notify a screen, "This epiLearn is not supported on Netscape browsers. epiLearn supports Internet Explorer 5.5 or above. Please launch it in Internet Explorer"

    My company has decided to use Epiplex software.
    But when a file with extension .htm as a product from Epilex is opened, there was a notify a screen,
    "This epiLearn is not supported on Netscape browsers. epiLearn supports Internet Explorer 5.5 or above. Please launch it in Internet Explorer".
    I prefer to use Mozilla than Internet Explorer. Would u please handle Mozilla browser along this problem to be available in this matter?

    This might be simple but it works well for me.
    1. 
    Right click on the tool bar in IE8 and uncheck adobe PDF to disable.  Click yes when it ask if you are sure.
    2. 
    Open Adobe
    READER located in the start menu.
    3. 
    Click on Edit and then on Preferences.
    4. 
    Select the "General" category.
    5. 
    Click on "Select default PDF handler"
    6. 
    Adobe Reader should be already selected. Change it to reader if it is not.
    7. 
    Click on "Apply" and except changes.
    8. 
    Restart the computer and you are done.
    Now you can open and save PDF's from IE8.  Once you save it, you can right click and "open with" Acrobat if you choose. 
    Be careful to not make Acrobat the default or you have to start over.
    You can still create PDF's from docs, scans, and picture like before.  You might think this is a work around but it really isn't. 
    Some forms that are available on the internet can't be opened by Acrobat for security reasons.
    Good luck!      P.S. I am not an IT tech but I play one on TV.

  • Opening files with no extension

    Adobe Reader is installed on 2 different PCs running Windows XP, PC1 and PC2.
    Both PCs need to open .pdf files with no extension, because an application renames files, let's say "file1pdf", as "file1", without altering the contents.
    On PC1 if I try to open a file, let's say "file1", I see a list of available applications including "Adobe Reader".
    On PC2 if I try to open the same file I don't see "Adobe Reader" in the list of available applications.
    Adobe reader is installed on both PCs.
    How can I add "Adobe Reader" to the list of available applications to open files with no extension on PC2?
    Regards
    Marius

    Click on "Browse" button at the "Open With" dialog and navigate to the location, where acrord32.exe is located. Preferebly, it should be this location "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe" unless you have installed at some customized location.  I'm assuming you have installed Reader 9. Once you add Adobe Reader in the open with list, it would continue to appear next time onwards.

  • Files with extension .sbc

    i recently started using vodafone email to listen to the messages but i receive them in files with extension.sbc
    any software to open those files and listen to my messages???

    Check [this page|http://www.neowin.net/forum/lofiversion/index.php/t540796.html] Doesn't look promising. Proprietary technology so if the main company doesn't support Macs then you're probably out of luck.

  • Process.start("winword", filename) can not open file with space in the path and name

    Hi,
    I am trying to write a class which can open file with selected application. for simplicity, now I just hard code the varaibles.
    the problem: if the path or file name has space in it, even it exist, winword still can not open it.
    could someone kindly show me what I did wrong and how to do it properly.
    Thanks in advance.
    Belinda
    public static class FileOpen
    public static void info()
    string path = @"c:\a temp folder\aaa 1.txt";
    if (File.Exists(path))
        // the file I am using in the sample does exist
         MsgBox.info("yes");
    else
         MsgBox.info("no");
    // working
    //Process.Start("winword", "c:\\aaa.txt");
    // not working
    //Process.Start("winword", "c:\aaa.txt");
    // not working
    Process.Start("winword", "c:\\a temp folder\\aaa 1.txt");
    // not working
    Process.Start("winword", path);

    string AppPath;
    AppPath = ReadRegistry(Registry.CurrentUser, "Software\\FabricStudio", "TARGETDIR", value).ToString() + @"help";
    string FileName = "'"+ AppPath + "\\ImageSamples.doc" + "'";
    try
    System.Diagnostics.Process.Start("Winword.exe", FileName);
    can any body please help for this.
    where i am making mistake?

  • Snow Leopard 10.6.2 CS4 InDesign can't open files with a "#" in file path

    Snow Leopard 10.6.2 CS4 InDesign can't open files with a "#" in file path using any of these perfectly normal methods:
    1. double-click file in the Finder (e.g in a Folder on your Mac or on your Mac desktop etc.)
    2. select file and choose "File... Open" command-o in the Finder
    3. drag file to the application icon in the Finder.
    4. Select file in Bridge and double-click, choose File.. Open.. or Drag icon to InDesign icon in dock.
    If you try to open an ID file named with a "#", you will get an error message "Missing required parameter 'from' for event 'open.'"
    This happens to any InDesign file that has a "#" (pound sign, number sign, or hash) in the filename or in the file path (any parent folder).
    To reproduce
    Name an InDesign file Test#.idd Try to open it in the Finder or Bridge (as opposed to the "Open" dilaog of InDeisng itself).
    "Solution"
    The file WILL open using File... Open... command-o while in InDesign application.
    Rename the file or folders that have a "#" (shift-3) in the filename.
    Report to Adobe if it bugs you.
    This does not occur in "plain" Leopard 10.5 nor Tiger 10.4
    Untested in Panther or before and
    Untested with CS3 and earlier in Snow Leaopard.
    Anyone have those and want to try this... ?

    In case this really bothers you: we've added a workaround for this into Soxy. If you enable the option, these documents will open fine on double-click.
    You need Soxy 1.0.7 from:
    http://www.rorohiko.com/soxy
    Go to the 'Soxy' - 'Preferences' - 'Other' dialog window, and enable 'Open InDesign via Script'
    (Irrelevant background info (it's all invisible to the user): the workaround works by special-casing how Soxy opens documents in InDesign: instead of using AppleScript, Soxy will use ExtendScript to instruct InDesign to open the document - which works fine).

  • Opening files with Illustrator and photoshop doesn't work, i have to drag the files from finder in to the program. This problem appears after opening 4 a 5 files.

    Opening files with Illustrator and photoshop doesn't work, i have to drag the files from finder in to the program.
    This problem appears after opening 4 a 5 files, rebooting helps another 4 a 5 times and appears again.

    I'd recommend reposting in the Boot Camp forum, that is where the Boot Camp and Windows gurus hang out.
    Good luck.

  • Adobe Bridge CC crashes when opening file with Photoshop CC or Camera RAW!

    Adobe Bridge CC crashes when opening file with Photoshop CC or Camera RAW!
    - Tried to Reset the preference with CTRL + Click.
    - It's just new clean install didn't do anything with it yet.
    - Windows 8.
    Any help?

    Just that one project, or any project?  Can you create new projects?

  • Photoshop CS6 (Mac) crashes when opening files with type or using the type tool

    Hi,
    Photoshop CS6 keeps crashing when using the type tool or when opening files with type on it. I've quit suitcase, disabled the suitcase plug-in, reset the preferences in Photoshop there's no crash report coming up either the application just dies! I am currently trying a system restore from time machine to see if that works!. Any other suggestions would be greatly appreciated.
    Many thanks
    Olly

    http://blogs.adobe.com/crawlspace/2012/07/photoshop-basic-troubleshooting-steps-to-fix-mos t-issues.html
    http://helpx.adobe.com/photoshop/kb/troubleshoot-fonts-photoshop-cs5.html

  • Can´t open files with camera raw

    Hi!
    I use Adobe Photoshop CS3 and the option to open files with Camera Raw is disabled in Bridge and in PS.
    Can anyone help?

    While each situation can be different this has been discussed on several threads. Scan down the list or do a search. If you can't find the answer, post a note.

  • Indesign opens files with no space between each word, this happened after a mac update, help?? I don't want to have to go through and manually do it.

    indesign opens files with no space between each word, this happened after a mac update, help?? I don't want to have to go through and manually do it.
    thanks in advance!

    If you are unable to enter the passcode into your device, you will have to restore the device to circumvent that passcode.
    Is the music purchased from iTunes? If it is you can contact iTunes support and ask them to allow you to re-download the music that you purchased from iTunes.
    Also, do you sync the device regularly? When syncing an iPod Touch/iPhone a backup file is made. That backup file doesn't contain your music but it does contain your address book, application data, pictures, notes, etc. After restoring your device, you can try restoring from the last backup that was made of your device so you will not have to start over completely from scratch.
    Hope this helps!

Maybe you are looking for

  • No data in cube

    Hi, I create a mapping for cube, debugging shows that everything works well, and the loading data process also works, but at last there's no data in the cube. Could some one tell me what can be the problem? Thanks very much. And also, does warehouse

  • Sent step by step apdu command to load cap file into javacard

    Dear All, I have log file about process loading cap file into card: Loading "E:\Sample.cap" ... T - 80F28000024F00 C - 08A000000003000000019E9000 ISD AID : A000000003000000 T - 80E602001407A000000132000108A00000000300000000000000 C - 009000 T - 80E80

  • Macbook Pro Fan issues

    I have a Macbook Pro 2.33. It recently starting making some noise. I suspected it was the fan. I went on youtube to see how to replace a fan. I found several videos on how to do that. I opened the laptop, powered it up and found that the fan on the r

  • Renaming Finder´s tracks from iTunes

    Situation: I have a folder in Finder with all my songs but these are not renamed properly... it came like this, when i burned the CD into my hard disk: Example: "09-jump" (which means - Track: nº9 / Title: Jump / Author: Madonna) Question: After doin

  • Host for web site

    Hi, I'd like to develop a personnal web site using Servlets and jsp. How can I find a public host server allowing this technology ? LudoD