Can't properly unzip archive when use  ZipInputStream

Hello.
Have some problem with ZipInputStream.
I have two simple tasks:
1. Download zip file from web.
2. Unzip file.
Zipped archive contains four text files.
So, all of the above is simply resolved with a help of ZipFile class, but when i use ZipInputStream, i got only one of four files unzipped in output, where i am did a mistake?
Here is the code:
URL url01=new URL(....);
ZipInputStream zis01=new ZipInputStream(url01.openStream());
            ZipEntry zipEntry;
          while((zipEntry=zis01.getNextEntry())!=null){
                if(!zipEntry.isDirectory()){
                    PrintStream ps01=new PrintStream(new FileOutputStream(zipEntry.getName()),true);
                    BufferedReader bffr01=new BufferedReader(new InputStreamReader(zis01));
                   String line;
                    while((line=bffr01.readLine())!=null){
                        ps01.println(line);
                    ps01.close();
                zis01.closeEntry();
            zis01.close();Edited by: 814785 on Sep 4, 2011 6:03 PM

EJP wrote:
PrintStream also swallows exceptions.Of course you are right. I handle all necessary exceptions ...You're missing the point. PrintStream doesn't throw them in your code. None of the print() or println() methods throws any exception at all. You have to write extra code. You have to call checkError(). See the Javadoc.Thank you, EJP, I'm already know about this moment. The question is about ZipInputStream behavior, not about how to catch and handle exceptions. There is no exceptions in my code. I tried methods with buffering, without buffering - no success.
As i wrote, the solution is in compression method. ZipFile works - that is enougth, ZipInputStream understrand only old zip archives, to be more exact: method getNextEntry() can't read all entries. You can do your own test, i can send you my archive if you want.
One of other variant of code without any buffers (also doesn't work properly):
ZipInputStream zis01=new ZipInputStream(new FileInputStream("unzipme.zip"));
            ZipEntry zipEntry;
            while((zipEntry=zis01.getNextEntry())!=null){
                if(!zipEntry.isDirectory()){
                    FileOutputStream fos01=new FileOutputStream(zipEntry.getName());
                    int count;
                    while((count=zis01.read())!=-1){
                        fos01.write(count);
                    fos01.close();
                zis01.closeEntry();
            zis01.close();Edited by: user124 on Sep 5, 2011 4:34 PM
Edited by: user124 on Sep 5, 2011 4:48 PM

Similar Messages

  • How can we get ADFSecurity work when used in OC4J, OID and OAM?

    I am getting error in http server log "mod_oc4j: Response status=499 and reason=Oracle SSO, but failed to get mod_osso global context."
    But I am not using Oracle SSO and my client doesn't want to use it either, I am using OAM SSO(CoreIDSSO) in my configuration. Please read the details below.
    I am using ADFSecurity in an app that is protected by OAM. To migrate ADFSecurity permissions from
    system-jazn-data.xml to OID, I used JAZNMigrationTool to populate OID with Grantees and Permissions. OAM gives login page, and authentication works fine.
    But ADFSecurity is not working. ADFComponent Delete button is enabled even for roles that dont have permissions for the iterator delete.
    - The app works fine when I use without OAM. ADF Security permissions work fine.
    - The app works fine when used with OAM, but with ADFSecurity disabled (enforce=false).
    - When I enforce ADFSecurity alongwith OAM, ADFSecurity is not working.
    In the doc "Oracle Containers for J2EE Security Guide b28957", there is a mention of use of CoreIDPrincipal for permissions. Our OID Permissions entries show
    LDAPRealmRole for attribute orcljaznprincipal. I am not sure if this could be the reason.
    We have configured AccessServerSDK for the SOA instance and have policy for the urls in the policy manager. We have entries in orion-application.xml, orion-web.xml and system-jazn-data.xml as per the documentations.
    How can we get ADFSecurity work when used with OID and OAM?

    Have you been able to successfully integrate OAS with OAM & OID? We have similar requriement and so far we have not been able to get it working.
    We have application specific roles which we map to OID roles using orion-application.xml.
    Any pointers to achieve this would be greatly appreciated.
    thanks,
    Dipal

  • After I installed the recent Apple security patch, I can no longer save PDFs when using Safari. And Firefox no longer can open website PDFs. Any suggestions?

    After I installed the recent Apple security patch, I can no longer save PDFs when using Safari. And Firefox no longer can open website PDFs. Any suggestions?

    Dansyacht wrote:
    If the previous Safari suggestion doesn't work try the following:
    In Finder, go to Macintosh HD/Library/Internet Plug-ins and move AdobePDFViewerNPAPI.plugin to the Disabled Plug-ins Folder.  Restart Safari.  If this works you may just want to delete that FUBAR plug-in.
    Thanks.  This was the solution for me.
    Message was edited by: tvdowntown

  • HT2188 I can hear caller but they can not hear me except when using speaker phone

    I can hear caller but they can not hear me except when using speaker phone

    First of all,  make sure that your iPhone as the most recent iOS available. Check in "Settings>General>Software Update".
    One other problem could be your microphone. Does it work for anything else other than a call?
    Good-Luck!
    kpower28
    Please mark this as "solved my problem" or "helped me"!

  • Why can I only make calls when using speakrphone?

    I can only make phone calls when using the speaker phone or headphones.  The receiver can hear me although I can not hear them.  I have only had the phone since Sat, have checked volume levels and tried adjusting during a phone call too.

    Try making a call and turning the volume up using the buttons on the side of the phone. If that doesn't work, your iPhone is faulty. Take it to the nearest apple store or back where you bought it!

  • What can replace Appleworks Drawing app when using OSX Mountain Lion?

    What can replace Appleworks Drawing app when using OSX Mountain Lion?

    Please see this page which examines the problem:
    http://www.wilmut.webspace.virginmedia.com/notes/aw/page3.html

  • How can I customize the toolbar when using the attribute browser

    In CVI 2012, the toolbar changes depending on the environment, e.g. it is different for the source window and the UI editor. The toolbar can be customized using the menu Options / Toolbar...
    Unfortunately, when using the attribute browser of the UI editor, another toolbar is displayed, i.e. not the UI editor toolbar.... I would have assumed that the attribute browser belongs to the UI editor, obviously it doesn't... So how can I customize the toolbar when using the attribute browser?
    Solved!
    Go to Solution.

    Luis,
    It's nice to have you back 
    Thank you for the clarification, so I'll elaborate a bit more: In the regular workspace toolbar, I have a disk symbol to save the file. This symbol is gone in the attribute browser...
    So I have three different toolbars, for source code (workspace), UI editor, and the UI editor displayed but the attribute browser clicked on (selected)... 
    Thanks
    Wolfgang
    Source code:
    UI editor:
    Attribute browser:

  • Can't get my mail when use the USB Ethernet adapter

    I can't get my mail when use the Apple USB Ethernet Adapter. If I use a wireless connection, there is no problem. The LAN which I'm trying to connect is behind a proxy server but the Internet is working 100%.

    Hi ViK,
    This sounds like a question for the network administrator of the location. Without knowing how the proxy is set it's impossible to know what it's blocking (incoming/outgoing). It sounds like it might be filtering the incoming mail server.

  • Please help. my address bar has vanished. i have no idea how to retrieve it, so can only access bookmarked sites when using firefox.

    please help. my address bar has vanished. i have no idea how to retrieve it, so can only access bookmarked sites when using firefox.

    Make sure that you do not run Firefox in Full Screen mode with all toolbars hidden.
    * Press F11 to toggle full screen mode (Firefox/File > Full Screen)
    If the menu bar is hidden then press the F10 key or hold down the Alt key, that should make the menu bar appear.
    Make sure that toolbars like the "Navigation Toolbar" and the "Bookmarks Toolbar" are visible: "View > Toolbars"
    * If items are missing then open the Customize window via "View > Toolbars > Customize" or via "Firefox > Options > Toolbar Layout" (Linux, Windows)
    * If a missing item is in the toolbar palette then drag it back from the Customize window on the toolbar
    * If you do not see an item on a toolbar and in the toolbar palette then click the "Restore Default Set" button to restore the default toolbar set up.
    See also:
    * http://kb.mozillazine.org/Toolbar_customization

  • Can't access some sites when using Aiport Express, why?

    I'm using Windows 7 and my router is a wireless Apple Airport Express that is approximately two years old. Suddenly I can't access some sites (for example www.sthlm.friskissvettis.se, or www.vegetarian-shoes.co.uk, some streamed tv-shows on svtplay.se, and a number of other random sites) when connecting to internet with my router. It worked good until recently and I'm fairly sure this problem emerged when my ISP upgraded from 10/10mbit to 100/10mbit speed. Most other sites like facebook and google works fine.
    When using my network cable to connect to internet everything works fine and I can access these sites.
    Firmware is current and I've tried reseting the router to factory defaults.
    Tried different browsers, and I can't ping the "blocked" sites either. Tracert www.sthlm.friskissvettis.se starts with 10.0.0.1 and continues through a number of long addresses until it says timeout. The last working address before timeout was sth-tcy-ipcore01-ge-0-2-0.neq.dgcsystems.net [83.241.252.13], if it matters. Tracert www.vegetarian-shoes.co.uk also eventually gives me a timeout.
    When the network cable is plugged in, I still get timeout on tracert www.sthlm.friskissvettis.se even though I can access the site in Chrome. Weird. www.vegetarian-shoes.co.uk doesn't give me a tracert timeout when the cable is plugged in, and I can access the site as usual.
    I've tried changing DNS servers to use opendns servers instead, but to no use.
    I've tried pinging these two sites with a lower MTU packet size (with this method: http://www.richard-slater.co.uk/archives/2009/10/23/change-your-mtu-under-vista- or-windows-7/), but still can't access them through ping...
    I don't know what to do anymore.... any suggestions???
    Thanks

    Hi Punice
    first try to disable JavaScript from : Firefox button (or Tools menu) > Options > Content panel > '''UNcheck''' Enable JavaScript.
    if the above does not help check with a few malware/virus scan programs for virus. You need to use all programs because each detects different malware. Make sure to update each program to get the latest version before doing a scan.
    http://housecall.trendmicro.com/ - Trendmicro online
    http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    http://www.superantispyware.com/ - SuperAntispyware
    http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    http://www.microsoft.com/windows/antivirus-partners/windows-xp.aspx
    check also for a rootkit infection with TDSSKiller.
    http://support.kaspersky.com/viruses/solutions?qid=208280684
    thank you

  • Can get lower case letters when using bios

    I purchased a used macbook air.  Changed the user to me but never changed the old user password.  I recently autorize an update and I can't get in without a password.  I never changed the old user password and newer assigned a password to my name.  Now I can't get in.  I tried going to the bios but I only cant type upper case letters and no lower case letters.  Can someone help me as to how I can type lower case letters when I start the bios?

    Unfortunately this is often the case, particularly if the field is not properly identified as a password field, and is true for both Web pages as well as (poorly designed) BlackBery applications.
    I've just gotten into the habit of typing the first letter of my password, then hitting the [Del] key, then typing in my full password all the time!
    Jerry

  • AutoSize not working properly in TextField when using non-zero line spacing

    When using non-zero line spacing, the autoSize property is not functioning as expected, causing text fields to scroll that shouldn't.  Also, when using device fonts, the sizes of the TextFields are wrong in the Flash IDE.
    I have a TextField whose height is supposed to be dynamic, depending the width of the TextField.  wordWrap is true, the text is left aligned, and the autoSize value is flash.text.TextFieldAutoSize.LEFT.
    When the TextField's width is adjusted, the height increases or decreases as expected, but when I scroll the mouse wheel over the TextField, it allows a single line to scroll out of view.  This should not be happening.  The autoSize property should ensure the TextField is large enough to neither require nor allow scrolling.
    Has anyone else encountered this issue or know how to fix it?
    Update: Been a problem since at least 2006! > http://blog.nthsense.net/?p=46
    http://www.kirupa.com/forum/showthread.php?288955-Disabling-textfield-scrolling   Bug is caused by using a line height ("line spacing" in Flash) larger than zero, for example 1.0pt.  It looks like when I reduce the line spacing of the text field to zero, the issue goes away.  There doesn't seem to be anything wrong with how autoSize is calculating the required height of the text (i.e. it is exactly textHeight + 4 pixel gutter, and drawing the rectangle (2,2,textWidth,textHeight) aligns visually with the text), so it must have to do with how the TextField is deciding whether it needs to scroll or not, and that separate calculation is being thrown off by the non-zero line spacing.  The additional non-zero spacing at the end of the last line could be making the TextField think it needs to scroll, even though it's hight is sufficient at "textHeight + 4".  Apparently the problem manifests when using a non-zero leading value as well.
    In fact, it has to be related to the leading value exactly, since the following code stops the textfield from scrolling.
    //body is TextField
    var tlm:TextLineMetrics = body.getLineMetrics(body.numLines - 1);
    trace(tlm.leading); //traces "1" here.  traces zero when line spacing is zero, and traces larger values with larger line spacing values
    body.autoSize = flash.text.TextFieldAutoSize.NONE; //turn off autosize so the height can be set manually
    body.height += tlm.leading; //increase height of textfield by leading value of last line to cause scrolling to be turned off.
    Honestly, this is pretty unacceptable bug.  First of all, scrolling should not be sensitive to trailing line spacing, because autoSize and textHeight do not include it. It need to be consistent, and I think textHeight and autoSize setting height = textHeight + 4 is correct.  Vertical scrolling should use textHeight as it's guage for whether scrolling is necessary, but instead, it's obviously involving the leading values of the last line.  At the very least, vertical scrolling should simply be disabled when autoSize is turned on and wordWrap is true, because the TextField should be big enough to fit all the text.  The workaround of manually adjusting the height is also no good, since turning autoSize back on will immediately change the size back and trigger scrolling again.  I also shouldn't have to set line spacing to zero just to use the autoSize feature, since the scrolling calculations are wrong in this way.

    No, lol.  Luckly, I replace most of my TextFields on the display list with my subclass TextFieldEx.  I just call a clone method that accepts a TextField and returns a TextFieldEx with identical properties.
    I corrected the problem via modifying the subclass to behave differently when autoSize is not NONE and wordWrap is true.  Under those conditions, the maxScrollV and scrollV property values are fixed at 1, and the class listens for its own SCROLL event and sets scrollV to 1 when it occurs.  That allows me to leave everything else alone, including text selection, and use whatever line spacing I want.
    The modification seems to work fine so far.
    For anyone interested in doing something similar, here is a clone method that will copy a TextField.
    public static function clone( t:TextField ):TextFieldEx
                                  var te:TextFieldEx = create( "", t.width, t.type, t.multiline, t.wordWrap, t.selectable, t.embedFonts, t.defaultTextFormat );
                                  te.alpha = t.alpha;
                                  te.alwaysShowSelection = t.alwaysShowSelection;
                                  te.antiAliasType = t.antiAliasType;
                                  te.autoSize = t.autoSize;
                                  te.background = t.background;
                                  te.backgroundColor = t.backgroundColor;
                                  te.blendMode = t.blendMode;
                                  //te.blendShader = t.blendShader;
                                  te.border = t.border;
                                  te.borderColor = t.borderColor;
                                  te.cacheAsBitmap = t.cacheAsBitmap;
                                  te.condenseWhite = t.condenseWhite;
                                  te.displayAsPassword = t.displayAsPassword;
                                  //te.embedFonts = t.embedFonts;
                                  te.filters = t.filters;
                                  te.gridFitType = t.gridFitType;
                                  te.height = t.height;
                                  te.opaqueBackground = t.opaqueBackground;
                                  te.restrict = t.restrict;
                                  //te.selectable = t.selectable;
                                  te.sharpness = t.sharpness;
                                  te.thickness = t.thickness;
                                  te.transform = t.transform;
                                  //te.type = t.type;
                                  te.useRichTextClipboard = t.useRichTextClipboard;
                                  //te.wordWrap = t.wordWrap;
                                  //Assign text last
                                  te.htmlText = t.htmlText;
                                  return te;
    //And the create method it uses
    public static function create( text:String = "", width:Number = NaN, type:String = null, multiline:Boolean = false, wordWrap:Boolean = false, selectable:Boolean = true, embedFonts:Boolean = false, font_or_textformat:*=null, size:Object=null, color:Object=null, bold:Object=null, italic:Object=null, underline:Object=null, url:String=null, target:String=null, align:String=null, leftMargin:Object=null, rightMargin:Object=null, indent:Object=null, leading:Object=null ):TextFieldEx
                                  var tf:TextFieldEx = new TextFieldEx();
                                  tf.width = isNaN(width) ? 100 : width;
                                  tf.defaultTextFormat = (font_or_textformat is TextFormat) ? (font_or_textformat as TextFormat) : new TextFormat( font_or_textformat as String, size, color, bold, italic, underline, url, target, align, leftMargin, rightMargin, indent, leading );
                                  tf.embedFonts = embedFonts;
                                  tf.multiline = multiline;
                                  tf.wordWrap = wordWrap;
                                  tf.selectable = selectable;
                                  tf.type = type;
                                  tf.text = text; //setting text last ensures the text line metrics returns correct values
                                  //Initialize the TextField's size to fit the text.
                                  if (!multiline)
                                            //When in single-line mode and no specific width is given,
                                            //expand width to entire line.
                                            if (isNaN(width))
                                                      tf.width = tf.textWidth + 4; //match width of text
                                  //Height is always automatically adjusted to fit the text by default.
                                  //It's better than the arbitrary 100px default height.
                                  var minimum_height = tf.getLineMetrics( 0 ).height;
                                  var h:Number = tf.textHeight;
                                  tf.height = (h < minimum_height) ? (minimum_height + 4) : (h + 4); //match height of text, ensuring height is at least enough to display one line, even if there is no text
                                  return tf;

  • How can i set  "Createdby" attribute  When using Custom JheadStart Security

    Hello
    We do not use JASS for Authentication , please help us how can i set createtby attributes with jhs.username in application for any entity object?
    thanks

    See a similar question at History Attributes when using Custom Authentication Type

  • Can't get speaker sound when using Mophie battery case

    Hello,
    Is there a way to make my phone's speakers enable when using the Mophie?  Just to explain, the Mophie is a batter pack case, that has an apple plug on the bottom.  It works great and all, but my phone speaker's go off.  Similar to using a docking clock/radio and the speaker will go through that device.  The Mophie doesn't have its own speakers though, so I can't use the speakers as I use it.
    Thanks!
    -Rick

    It shouldn't do that. Talk to the manufacturer. If it's shutting down the speakers on the phone, either your dock connector is dirty or the juice pack is defective.

  • Can I assign exchange rate when use MRKO?

    Dear all:
    I have met one question.
    When I use MRKO to settle consignment stock withdraw, how can I assign exchange rate I do really need?
    Thank you.

    Sorry, I am not  meant where to maintian exchange rate .
    I want to assign the exchange rate date  when Use MRKO.
    Ex: when I transfer  the consignment  stock  into our own stock(mvt. 201 K or 411 k) on 4/30 , and the vendor send their invocie on 5/6 .When I use MRKO , the exchange rate is reference to 5/6 , not 4/30 . I want to know where can I configure and let the MRKO's exchange rate date is the stock GI date .
    Thank you.

Maybe you are looking for

  • Macbook Pro Retina Boot Camp Issue

    Hi all, I recently purchased a macbook pro with retina display and installed windows 7 on it with boot camp.  Windows 7 on boot camp does not wake on sleep after closing the lid or making it sleep for the second time.  I have tried unplugging, pressi

  • Macbook Pro Rev B.

    My apologies if there has recently been a post made about this but I was curious if anyone had any relatively solid speculation as to how long it would be before there was a MBP Rev. B and Apple will have a whine free MBP? Or at least have the major

  • RULE hint and 11g

    Oracle Standard Edition 11.1.0.7.0 We all know that the RULE hint is not longer supported, so in that case why would Oracle themselves want to use it ? select parsing_schema_id,sql_Text from v$sqlarea where upper(sql_text) like '%+ RULE%' or upper(sq

  • Upgrading to Production Version of XE

    Is it necessary to un-install XE-Beta prior to re-downloading the production version. Below is the version information for what I have currently installed. I didn't want to start the download process without first understanding what the install progr

  • HT3737 how do you cut and paste on an iMac

    how do you cut and paste on an imac