What's that: ZipException: incorrect data check ??

Hi,
I'm still trying to write a String compressor, and I got one working right now, but
when I use it with certain patterns, I get the ZipException.
Any ideas??
public final static String enc(String what)
     try
          ByteArrayOutputStream out = new ByteArrayOutputStream();
          DeflaterOutputStream dos = new DeflaterOutputStream(out,new Deflater(Deflater.BEST_SPEED,false));
          dos.write(what.getBytes("UTF8"));
          dos.finish();
          dos.flush();
          dos.close();
          return out.toString();
     }catch(Exception e)
          e.printStackTrace();
          return "";
public final static String dec(String what)
     try
          ByteArrayOutputStream out = new ByteArrayOutputStream();
          ByteArrayInputStream in = new ByteArrayInputStream(what.getBytes());
          InflaterInputStream iis = new InflaterInputStream(in,new Inflater(false));
          byte[] buffer = new byte[1024];
          int offset = -1;
          while((offset = iis.read(buffer)) != -1)
               out.write(buffer, 0, offset);
          iis.close();
          return out.toString("UTF8");
     }catch(Exception e)
          e.printStackTrace();
          return "";
}For tests:
        // Exception
        String test = "abcdefghijklmnopqrstuvwxyz";
        System.out.println(test);
        System.out.println(enc(test));
        System.out.println(dec(enc(test)));
        // works perfectly.
        test = "Eu m� duc la pia�� �i cup�r fasole";
        System.out.println(test);
        System.out.println(enc(test));
        System.out.println(dec(enc(test)));

Hmm, maybe I'll get some feedback if i post it unformatted ??
public final static String enc(String what)
try
ByteArrayOutputStream out = new ByteArrayOutputStream();
DeflaterOutputStream dos = new DeflaterOutputStream(out,new Deflater(Deflater.BEST_SPEED,false));
dos.write(what.getBytes("UTF8"));
dos.finish();
dos.flush();
dos.close();
return out.toString();
}catch(Exception e)
e.printStackTrace();
return "";
public final static String dec(String what)
try
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayInputStream in = new ByteArrayInputStream(what.getBytes());
InflaterInputStream iis = new InflaterInputStream(in,new Inflater(false));
byte[] buffer = new byte[1024];
int offset = -1;
while((offset = iis.read(buffer)) != -1)
out.write(buffer, 0, offset);
iis.close();
return out.toString("UTF8");
}catch(Exception e)
e.printStackTrace();
return "";
For tests:
// Exception
String test = "abcdefghijklmnopqrstuvwxyz";
System.out.println(test);
System.out.println(enc(test));
System.out.println(dec(enc(test)));
// works perfectly.
test = "Eu m� duc la pia�� �i cup�r fasole";
System.out.println(test);
System.out.println(enc(test));
System.out.println(dec(enc(test)));

Similar Messages

  • FYI DU error:"Reserved fields in the catalog record have incorrect data"

    I had a very perplexing problem...
    My iMac G5 was shutting down by itself so I took it to Apple and had the power supply replaced. After it was repaired I was concerned about the hard drive health after the unexpected shutdowns. So I ran Disk Utility and encountered the following...
    The iMac G5 is running OS 10.4.6.
    I ran "Repair Disk Permissions" from Disk Utility and encountered no errors.
    I ran "Verify Disk" from Disk Utility on the drive and I get these results (copied from DiskUtility.log):
    Verifying volume “TheDisk”
    Checking HFS Plus volume.
    Checking Extents Overflow file.
    Checking Catalog file.
    Checking multi-linked files.
    Checking Catalog hierarchy.
    Checking Extended Attributes file.
    Reserved fields in the catalog record have incorrect data
    Checking volume bitmap.
    Checking volume information.
    The volume TheDisk needs to be repaired.
    Error: The underlying task reported failure on exit
    Disk Utility stopped verifying “TheDisk” because the following error was encountered:
    The underlying task reported failure on exit
    1 HFS volume checked
    Volume needs repair
    This occurs whether I run it while booted from the hard drive or the restore disc. While booted from the restore disc, running repair disc indicates that the failure could not be fixed.
    Booted from the hardware test disc and all tests passed.
    Booted from TechTool Pro disc and all the tests passed.
    Booted from Disk Warrior (had to get the "free" update to boot my iMac G5) and rebuilt directory. No errors reported.
    Still same error reported in Disk Utility. ???
    Booted iMac in 'safe' mode. Rebooted iMac normally.
    Disk Utility now reports success!

    Sorry but this is not assistance to you but an additional request for help from someone!!!
    I had the same thing occur just now!!!! I have used everything in site and keeps returning............
    Hope someone has an answer as to why this occured....

  • Credit Limit VS Posted Date Check

    Dear Experts
    Our client have a requirement on customer credit limit and I would like to seek for some good solutions.
    Here I provide one sample scenario: In SAP Business One a customer with a credit limit of $100,000 and account balance of $110,000. After a posted date check of $20,000 is deposited, customer account balance will be reduced to $90,000 and a Sales Order/ AR Invoice with amount less than $10,000 can be added for that customer without credit limit alert.
    However, our client thinks that it is not make sense to reduce the customer account balance given that a posted date check is deposited as the posted date check may not be cashed if the customers do not have money in their account.
    Would it be possible to separate posted date check payment amount from deducting the customer account balance? or would it be other workarounds?
    Thank you very much
    Regards
    Elton

    Dear jbrotto
    Thanks for your reply.
    Could you explain in details on how to make use of the commitment limit?
    As far as I know, commitment limit also considers the account balance of customer
    Regards
    Elton

  • Why is Metastream plug-in listed when I do a Plug-in Check on what plugins are up to date, I thought it was blocked?

    MetaStream 3 Plugin is listed as a Plugin, Status Unknown when I click on "Check on what plugins are up to date" of the Add-ons Manager. (I think this has just recently started happening.) The three other plugins listed are active and none of the other supposed inactive or blocked ones are listed.
    The Add-ons Manager does indicate Metastream has been disabled due to security issues.
    Is this normal or of concern?

    Regardless of if a plugin is disabled or enabled, it will still display on the plugin check.<br>
    This is to ensure that if the plugin is enabled the user is running the most current and secure version of that plugin.

  • My iphone 5s got stolen and the option to erase data after 10 tries was not enabled. What happens after the incorrect password is input after 10 times?

    my iphone 5s got stolen and the option to erase data after 10 tries was not enabled. What happens after the incorrect password is input after 10 times?

    After the sixth erroneous passcode entry a delay is imposed that increases exponentially and eventually reaches over 40 years before another attempt can be made.
    No one yet knows how long the next delay is.

  • I have a PC with a internet connection through a modem and ever since i have had it i have had no connection to the itunes store. And even if I try to update anything it says that i need to check my connection, but my connection is fine. What should I do?

    I have a PC with a internet connection through a modem and ever since i have had it i have had no connection to the itunes store. And even if I try to update anything it says that i need to check my connection, but my connection is fine. What should I do?

    This almost always indicates your firewall or anti-virus utilities are preventing iTunes from contacting the iTunes Store. Here is an exerpt from "Can't connect to the iTunes Store": http://support.apple.com/kb/TS1368
    Troubleshooting on Windows
    If you haven't been able to connect to the iTunes Store for more than a day —and other customers on our discussion boards aren't experiencing similar issues— a software or internet service provider (ISP) configuration issue may be blocking your access to the iTunes Store. Click here to find out which ports and servers need to be allowed for iTunes Store access.
    Update iTunes to the latest version.
    If you have not done so already, try the steps in iTunes for Windows: iTunes Store connection troubleshootingto troubleshoot iTunes Store connectivity in Windows.
    Firewall issues:
    Windows XP: If you've upgraded to Windows XP Service Pack 2: By default, Windows Firewall is enabled. As with all firewalls not manufactured by Apple, you will need to configure Windows Firewall to allow iTunes to access the iTunes Store. To do so, see How to enable iTunes in the Windows XP Firewall.
    Windows Vista and 7: As with all firewalls not manufactured by Apple, you will need to configure Windows Firewall to allow iTunes to access the iTunes Store. To do so see, the "Blocked by software firewall" section in this article.
    Proxies can cause issues and should be avoided whenever possible. To disable the proxy built-in to Windows see, iTunes for Windows Can't access the Internet if proxy settings are incorrect.
    If you are receiving a specific error message you may want to see, the "Specific Conditions and Alert Messages" section in this article as needed.
    If the issue still persists, contact your internet service provider and confirm that the ports and servers in this article are enabled over your network.
    The "hosts" file may be blocking the iTunes Store
    Microsoft's article How do I reset the hosts file back to the default? has instructions and a "FixIt" to have Windows try to reset the hosts defaults for you.
    Note: Some workplaces may put internal resources in the hosts file but may also use it to block iTunes Store.
    To create a copy of your hosts file and replace it with an empty hosts file, follow the instructions for your operating system below.

  • What r the conditions that u hav to check for automatic invoice split ( fro

    what r the conditions that u hav to check for automatic invoice split ( from order to proforma invoice)

    You can find out the exact fields which lead to invoice split in the Data VBRK/VBRP field of copy control between the order and the invoice type at item category level.
    Find out this routine.
    Go to VOFM tcode and Data transfer-----Billing documents
    Here you can see the routine. See the code behind this routine. This will give you the exact criteria used for invoice split in your specific case.
    By default,
    It is payer, payment terms, incoterms, Billing date
    Hope this helps.
    Reward if this helps.

  • I keep getting this error message: ITunes was unable to load data class information from Synch Services. Reconnect or try again later. What does that mean? Can I fix it? or do I have to wait for the next update?

    I keep getting this error message: ITunes was unable to load data class information from Synch Services. Reconnect or try again later. What does that mean? Can I fix it? or do I have to wait for the next update?

    See TS2690: iTunes for Windows: "Unable to load data class" or "Unable to load provider data" sync services alert.
    tt2

  • HT4859 How can I verify that my App data is actually stored in iCloud. With Dropbox, I can actually see my stored files. With iCloud, itseems I'm supposed 2 just trust that Appl has the data. Short of doing a restore is there no way to check the data?

    How can I verify that my App data is actually stored in the iCloud. I can see and access my notebook, contacts etc. on the iCloud website, and I can see my photos in a folder on my Windows-based desktop compter (iCloud/Photostream). But no app data.
    With Dropbox, I can actually see all of my stored files. With iCloud, it seems, I'm supposed to just trust that Apple has my back. Short of deliberately trashing my app data and then attempting a restore, is there no way to check the data?

    You can't access them on Windows (unless you have iCloud enabled Windows programs) and I don't think any are, yet.
    iCloud data is accessed via Apps/Programs, the Windows programs vendors will have to step up (just to make it worse Microsoft have not yet enabled their Mac programs, such as Office yet) I doubt that iCloud access is much of a priority for them, complain to MS, when enough Windows users complain maybe they'll do something.

  • I try to backup my Macbook with Time machine, it goes fine and at the end it says that it could not be completed because "/Volumes/Data-2/ MacBook.sparsebundle is already in use".. What is that?!

    I try to backup my Macbook with Time machine, it goes fine and at the end it says that it could not be completed because "/Volumes/Data-2/ MacBook.sparsebundle is already in use".. What is that?!

    See #C12 in Time Machine - Troubleshooting

  • Some of my movies in iPhoto say a necessary data reference is missing.  What is that?  We upgraded to Lion, so is that the problem?  I saw that I need Quick Time 7 - but I think I have 10

    Some of my movies in iPhoto won't play.  It says a necessary data file is missing!  What is that? 

    Some of my movies in iPhoto won't play.  It says a necessary data file is missing!  What is that? 

  • In a FORM search box that i have data saved, how can I go and see what is saved and edit it?

    In a FORM search box that i have data saved, how can I go and see what is saved and edit it? Sometimes when I'm doing maintenance it all gets deleted and I would like to be able to see what I have saved before it gets deleted.

    Try this - Form History Control extension: <br />
    https://addons.mozilla.org/en-US/firefox/addon/12021/

  • TS3212 I get the file download window and I push "run", but after it starts to install, I get a window that says that they was a problem with the installation and I need to check with the manufacturer of my software. WHat does that mean?

    I get to the file download window to install itunes and push run, but after it starts to install, it stops and I get an error message that installation can no continue and everything is uninstalled. It tells me to check with my software company to resolve. What does that mean?

    Repair your Apple software update.
    Go to START/ALL PROGRAMS/Apple Software Update. If it offers you a newer version of Apple Software Update, do it but Deselect any other software offered at the same time. Once done, try another iTunes install
    If you don't find ASU, go to Control Panel:
    START > CONTROL PANEL > Add n Remove Programs / highlight ASU and click CHANGE then REPAIR,

  • Lightroom crashed EVERY SINGLE file and photograph is gone! There is a file on my screen bearing the title of what I was looking at prior to the crash, but says, "DATA". What IS that and where did all of my stuuf go??

    A few nights ago a message appeared in Lightroom, but before I could read it, it shut down. Yesterday, I opened it up again to resume with my assignment and it said my files were damaged. On the third try I got my work and all went well. Today as I was looking at my newest images and flagging them, Lightroom shut down 'again'. This time it took every saved file and photograph. I noticed a weird file on my monitor screen thereafter, "DATA........Irdata. What is that? If this is where everything is, how do I get it back....and into Lightroom? What is happening?

    Could you post a screen capture of your (User name)> My Pictures> Lightroom folder. Like the posted screen capture.

  • I just bought an iMac and I´m a new user of Mac.  I captured my data and my country is Mexico. What can i do if the final data check show España? Is it important or it doesn´t matter?

    I just bought an iMac and I´m a new User of Mac. I captured my data and my country is Mexico. What can i do if the final data check of Mac shows Spain? Is it important or it doesn´t matter?

    Hola & welcome to the Forums!
    Have you noticed any problems, like Time zone or Time display?

Maybe you are looking for

  • Can I use my Photoshop CC on multiple computers?

    Can I use my Photoshop CC on multiple computers?  How do I set it up on the second computer?  I have a desktop that I use primarily but also have a laptop that I need to use on occasion.   How do I set this up properly? Thanks for the help

  • Confirmed LRS at point of order but monthly LR cha...

    Hi - I ordered BTI2 on bt.com end of April when LRS was at £141 and received an order confirmation for that via email. Now I received my first bill and the line rental is charged at £15.99 and LRS is not activated. I called BT support but after 20 mi

  • Run forms and reports  6i on web

    hi every body please tell me how i run my existing forms and reports 6i run on web any tutorial or support thanks and regards ALLAH HAFIZ

  • SAP Certification and Compliance. Request for explanation.

    Hello, Could you please explain me the meaning of terms:      - SAP Certified      - SAP Compliant applied to the third-party applications? I will be grateful for some brief description as well as for references to SAP documentation which describes t

  • CS4, Bad ghosting exporting to iPod

    All, I need clips from a DVD transferred to a classic iPod. I got the sequence from the DVD in the timeline. I export the media to an mp4 large iPod format. The output shows people moving around like ghosts. How can I prevent it from trying to blend