Zipfile and zipinputstream code

Hi!
I need to unzip something that is in a bytearrayoutputstream. Since zipfile and zipinputstream does not receive bytearrayoutputstream I thought of creating my own but I don't know how to do that. I need someone to help me with the code. I need a code not advice please.
All I know is that it should extend to zipfile .
Please help

** a simple unZIP tool
** ex.  java UnZip file.zip file1   to unzip file 1 from file.zip
**      java UnZip file.zip         to unzip file.zip
import java.io.*;
import java.util.*;
import java.util.zip.*;
import java.text.*;
class UnZip {
  public static void main(String args[]) throws IOException {
    InputStream in = new BufferedInputStream(new FileInputStream(args[0]));
    ZipInputStream zin = new ZipInputStream(in);
    ZipEntry e;
    while((e=zin.getNextEntry())!= null) {
      if (args.length > 1) {
        if (e.getName().equals(args[1])) {
           unzip(zin, args[1]);
           break;
       unzip(zin, e.getName());
    zin.close();
  public static void unzip(ZipInputStream zin, String s) throws IOException {
    System.out.println("unzipping " + s);
    FileOutputStream out = new FileOutputStream(s);
    byte [] b = new byte[512];
    int len = 0;
    while ( (len=zin.read(b))!= -1 ) {
      out.write(b,0,len);
    out.close();
Courtesy of : http://www.rgagnon.com/javadetails/java-0067.html and http://www.rgagnon.com/howto.html

Similar Messages

  • Wht is diff b/w sy-ucomm and ok code

    hi,
    what is diff b/w sy-ucomm and ok-code
    Regards,
    Rani.

    Hi,
    sy-ucomm is for doing the functions what the user wishes to do at that particular event. You use it in menus and other place . this mainly in using <pfstatus>
    ok_code is generally used in screen as of I have used. You will define the function in the screen. and you can use it in the main program.
    ok_code acts just as a temporary variable that stores the value of sy-ucomm.
    When user interacts with the screen elements, the function code that you have assigned is filled in the sy-ucomm field which is turn gets reflected in OK_CODE.
    In your ABAP programs, you should work with the OK_CODE field instead of SY-UCOMM. There are two reasons for this: Firstly, the ABAP program has full control over fields declared within it, and secondly, you should never change the value of an ABAP system field. However, you should also always initialize the OK_CODE field in an ABAP program for the following reason:
    In the same way that the OK_CODE field in the ABAP program and the system field SY-UCOMM receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event. Therefore, you must clear the OK_CODE field in the ABAP program to ensure that the function code of a screen is not already filled in the PBO event with an unwanted value. This is particularly important when the next PAI event can be triggered with an empty function code (for example, using ENTER). Empty function codes do not affect SY-UCOMM or the OK_CODE field, and consequently, the old field contents are transported.
    Diff bet OK-CODE and SY-UCOMM
    Difference Between SY-UCOMM and OK_CODE
    ok_code/ sy-ucomm usage in dialog program

  • From which table i will get PO tax amont and tax code name.

    HI all
    I"m giving date to develop one Z report.Where i will get the PO tax amonut(not condition amount).i need total TAX amount and TAX code..from where i can get these two??
    plz help me
    thanks
    ramesh reddy

    Hi
    for excise check table J_1IEXCHDR for header
    J_1IEXCDTL for item excise
    The Table name used to find the Tax Values are
    KOMV: Pricing Communications-Condition Record
    KONV: Conditions (Transaction Data)
    From the above tables you can refer the fields below.
    KAWRT
    KBETR
    Fetch the corresponding records based on the field
    KNTYP
    Search net you will get many threads on this

  • How to do selective delete of the GL a/c, BA and Co Code from the BWrequest

    Hi,
    How to do selective delete of the GL a/c, BA and Co Code from the BW request ??
    Regards,
    Vivek

    Cube or DSO?
    Cube - manage - notedown the req number - selective deletion - enter req number at REQ ID and give the selection parameters as you need(GL a/c, BA and Co Code ) and execute.
    For DSo you can't do selective deletion on request id basis

  • Work Order list report that will includes Damage and Cause codes

    Is there a WO list report that includes fields of the Damage and Cause Codes?
    Thanks.

    Hi,
    Generally damages and causes  we update in notifications then i think there wont be a list which u r asking
    For notification  the t-code is iw69

  • Hi, my MacBook Pro cannot open Safari. nexpectedly while using the librooksbas.dylib plug-in" the report details the exception code as 'EXC_BAD_ACCESS (SIGSEGV)' and exception codes as: 'KERN_INVALID_ADDRESS at 0x0000000920

    Hi, my MacBook Pro cannot open Safari. It crashes and gives the message, ' Safari quit unexpectedly while using the librooksbas.dylib plug-in" the report details the exception code as 'EXC_BAD_ACCESS (SIGSEGV)' and exception codes as: 'KERN_INVALID_ADDRESS at 0x0000000920

    Remove "Rapport" by following the instructions on this page.
    Back up all data before making any changes.

  • My phone does not show contact names for country and area code while having in coming calls. Although, I have endorsed the name with numbers. How do I the problem. My one is a iphone 3s device with updated os. Please text to help

    My iphone does not recognize saved contact number while having incoming calls due to country and area code as auto prefix. How do i fix the problem. How do i ensure that the phone recognize calls with and without the country and area code. Please text to help.

    1) Open the Phone and dial *228. This is a Verizon over-the-air programming number.
    2) When the system answer press 1 for "Program or activate your phone"
    3) Wait for the call to disconnect. You should get a prompt stating something like, "Settings updated."
    4) Open the Task Manager and kill the Phone, Message, and Contacts Applications
    5) Wait a few minutes (I waited 3 just to be extra safe)
    6) Open the Message App to verify the fix

  • Oracle.jbo.NoDefException: JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-25058. Error message parameters

    Dear Guru's,
    I am not able to solve the above issue for last couple of days.
    I am newbie to the webservice
    My Issue...
    I am using Jdeveloper 11.1.2.4.0 Release 2
    1. Using Jdev I built one small Web Service with two methods.
            While testing the Webservice...
                   I passed User Id as Parameter and it successfully return the values (user id, user name and description) from fnd_user table
    2. I created another application to consume the web service i created.
                   1. I added the webservice SOAP and added the method.
                   2. Created a jsf page and drag and drop the parameter and return values to the jsf page.
    3. While executing the created jsf page I received the error message as below
    "oracle.jbo.NoDefException: JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-25058. Error message parameters are {0=Attribute, 1=UserName, 2=UserName}"
    Even I know that this issue is repeated one in our forum, I was not able to solve this issue.
    Can anybody help to solve this issue.
    Thanks and Regards,
    Durai S E

    Dear Guru's,
    I am not able to solve the above issue for last couple of days.
    I am newbie to the webservice
    My Issue...
    I am using Jdeveloper 11.1.2.4.0 Release 2
    1. Using Jdev I built one small Web Service with two methods.
            While testing the Webservice...
                   I passed User Id as Parameter and it successfully return the values (user id, user name and description) from fnd_user table
    2. I created another application to consume the web service i created.
                   1. I added the webservice SOAP and added the method.
                   2. Created a jsf page and drag and drop the parameter and return values to the jsf page.
    3. While executing the created jsf page I received the error message as below
    "oracle.jbo.NoDefException: JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-25058. Error message parameters are {0=Attribute, 1=UserName, 2=UserName}"
    Even I know that this issue is repeated one in our forum, I was not able to solve this issue.
    Can anybody help to solve this issue.
    Thanks and Regards,
    Durai S E

  • Wrong combination of Plant and Co code at the time of PO creation

    Dear all,
    At the time of creating PO when I am entering Plant and Company code system is not giving any error message if I am entering other Co code , i.e. Co code which is not assigned to the plant. I want an error message in case of maintaining wrong combination of plant and Co code.
    Any suggestion ??
    Reward assured for helpful answer.
    Thx and regds
    Amitava

    Go to SPRO - MM - Purchasing - Environment Data - Define Attributes of System Messages - System Messages
    Then maintain system messages 00 06 167 and then set as E (error) in category field.
    Reward if useful

  • How to find out what are the interfaces used for Job and Job Codes

    HI All,
    I just wanted to know how do we find out what are the interfaces used for Job and Job codes .
    Thanks In Advance
    Sunny

    Hi,
    Here is an idea for your request.
    Basically you can create a simple query on multiprovider 0TCT_MC01.
    Filter: you can use a variable for restriction of time ( calday, or calmonth) since you should be interested for a time period.
    Choose following characters into your objects:
    InfoProvider ( 0TCTIFPROV )  - you can create a variable for choosing infoprovider before query runs.
    *Tp.[Type of BI Application Object] 0TCTBISOTYP  = filter this with 'QUERY' or whatever your need is.
    *BI Application Object 0TCTBISBOBJ,  ( this will give you the name of the queries)
    In key figures choose,  Count for BI Appl. (0TCTWTCOUNT).
    (number for query run)
    Create a condition , for top 20.
    Hope this helps.
    Derya

  • OS X and classic creator and type codes

    Is there anyway, within the native os to change type and creator codes?
    Why would I want to? Here's an example:
    I get a .zip from a customer. Because I have Stuffit installed it takes ownership of the archive. That would be fine except I've noticed different results using stuffit vs. BomaArchive helper. As in they don't unzip with the same amount of files.
    I used to use Super Get info to change them, but that's not a possiblity now. And if Apple didn't hide Boma so deep in the OS I might be able to just make an alias and drop them on it. Won't find on a search for "Boma", both visible and invisible.
    Thanks for any help. I'm just trying to find another way to make my OS do what I want it to, not what some app develper or OS creator deems should happen.
    Remember... think different?

    You can easily change any document's default application by selecting the document icon, press COMMAND-I to open the Get Info window. In the section labeled Open With select the desired default app from the drop down menu. If you want all similar documents opened by the default app, then click on the Change All button.
    Alternatively download the freeware preference pane RCDefaultApp from www.versiontracker.com.
    BTW, not pointing a finger at you, but keep in mind that even morons "think different."
    Thanks for your ideas, and more, thanks for the jab at the slogan Apple used to use to differentiate itself, and it's consumers from other, less user friendly OS's.
    But your solution doesn't help me. I'm well aware of changing the assigned app through the get info window, and that there are other utilities as, if not more adept at this function. My problem is that, if I have to solve my problem this way, instead of gaining knowledge about what effect type and creator codes have in OS X and how to change and deal with them, I find it hard to impossible to track down the location of the app BomaArchiveHelper. It never appears in the "Open with" pop up, and therefore I need to know the location in order to navigate to it to tell OS X to use it. And being that I see different results when unzipping depending on which app was used to create the zip, I don't want to set it as default.
    So, my questions stand.
    How do you view and alter type and creator codes in OS X, and where exactly is BomaArchiveHelper located.
    G4 MDD Dual 1.25 Mac OS X (10.3.9)

  • Facebook like button is not working, I have used the muse widget and created code from facebook. Does anyone know how to get this to work?

    Facebook like button is not working, I have used the muse widget and created code from facebook. Does anyone know how to get this to work?

    Hi connally25,
    Below is a link to a video tutorial on how to add a Facebook Log button, please check if you have followed the same steps to add the video.
    http://tv.adobe.com/watch/learn-adobe-muse-cc/adding-a-facebook-like-button/
    If you have followed the steps correctly and the button still does not work; here is a link to a forum thread which might help solving the issue:
    Facebook Follow Widget not working
    Regards
    Sonam

  • Problem with business place and section code in miro screen

    hi experts,
    i have done the following config. for validate the b/place and section code at the time of invoice and payment.
    in prerequisite-com.code=l001 and (posting key=31 or posting key=29 or posting key=21 
    in check-business place=1001 and section code=1001
    by this config. in t code fv60 and f-48 b/place and section code showing mandatory but in miro screen w/o b/place and section code system alowing to save the entry.
    please suggest me where i am wrong and what to do next?
    thanks and regards
    konishko

    hi
    i have written the condition as follows
    in prerequisite:bseg-bukrs=l001 and (bseg-bschl=31 or bseg-bschl=29 or bseg-bschl=21)
    in check:bseg-bupla=1001 and bseg-secco=1001
    by doing this in fv60 and f-48 screen is not allowing to post w/o b/place and section code but in miro screen system allow me to post w/o b/place . if i validate the miro screen then after giving the b/place it is not allowing me to post the same and giving the error message which i have created.
    how to solve this problem?
    please suggest me and please give me the steps.
    regards
    konishko

  • Dreamweaver setting wrong file type and creator codes

    First of all, I'm running Mac OS X 10.5.2 on an Intel-based
    Mac, with Dreamweaver CS3 9.0 build 3481.
    I have a site defined where I connect to my web server via
    FTP. On my server, I just upgraded my forum software to PHPBB 3.0,
    which created a new /forums/ directory. My plan is to use
    Dreamweaver to download that new /forums/ directory to my local
    site where I can edit the files. Inside the forums folder are
    several types of files, like ".php" files, ".htm" files, ".gif"
    files, etc.
    So, upon downloading the /forums/ folder to my local machine
    by dragging and dropping it (in Dreamweaver) from the remote site
    to the local site, I noticed that Dreamweaver insists on setting
    HFS file type and creator codes for files it recognizes, based on
    the filename extension.
    I've connected to the same server using the Finder and
    Transmit, and copied the remote /forums/ folder over to my local
    machine. Neither of those copies have files with file types and
    creator codes set, meaning they aren't actually set on the remote
    files and that this is indeed something Dreamweaver is doing on the
    fly as it downloads the files.
    I'm wondering if there's any way possible to disable this
    behavior, and just download the files like they are on the server?
    (File extension only). To make matters worse, on my Intel-based
    Mac, it's not even setting the proper codes, as you can see in the
    following image:
    http://homepage.mac.com/mdouma46/images/dreamweaver.png
    Notice for the ".php" document, it's attempting to set a file
    type of 'TEXT' and a creator code of 'DmWr' (DreamWeaver's creator
    code), but because the Dreamweaver developers didn't bother to take
    into account the byte-ordering differences between PowerPC Macs and
    Intel Macs, the codes are written in reverse: 'TEXT' becomes
    'TXET', and 'DmWr' becomes 'rWmD'. (If you're going to use
    low-level routines such as FSSetCatalogInfo() to set the file types
    and creator codes, you need to call CFSwapInt32HostToBig() on the
    OSType values before doing so, to make sure they're in Big-endian
    format).
    Anyone know where the conversion information is stored?
    Thanks in advance.....

    Creator codes are totally deprecated in snow leopard. as for a workaround you can use something like this.
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #ADD8E6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    on open these_items
    repeat with this_item in these_items
    tell application "Finder"
    set the_file to POSIX path of (this_item as alias)
    tell application "System Events"
    set default application of file (the_file) to ("Main HD:Applications:Preview.app" as alias)
    end tell
    end tell
    end repeat
    end open</pre>
    save it as an application and drop files onto it to set them to open with Preview.

  • Creative Cloud Installation Failed Download Error - Error Type -7 and Error Code - 401

    I subscribed to Creative Cloud in December 2012 and have been trying to install the applications, but the "Installation Failed" through the Adobe Application Manager. (see screenshot)
    Here is a line from my log file:
    01/08/13 11:08:48:346 | [WARN] |  | ASU | PDApp | DownloadError |  |  | 6120 | Download Error has come with GDE Error type - -7 and error code - 401
    I tried searching for the same error code in the "knowledge base" but couldn't locate any.
    I am on a Windows 7 (x64) machine. I also have CS5.5 installed.
    Anyone have this problem? Please help or point me in the right direction if you can. Thanks!

    Thanks Romsinha,
       I tried the above steps, with no luck.  I have admin rights on both laptop and desktop I'm trying to install to.  I have updated my AAM on both machines with no issue (when using the direct link above). But when I click the 'Try' link to download an application, it shows the scrolling status bar for a few seconds, then  "Installation Failed"  'Download error. Press Retry to try again or contact customer support. (-7)'   Retry only produces same results.
    Both machines are running Win 7 Pro - SP1 64bit
         (laptop - 16 GB RAM & Core i7-2760QM 2.40 GHz processor)
         (desktop - 8 GB RAM & Xeon W3520 2.67GHz processor)
    I am running in a corporate setting with I'm sure all sorts of Firewall protection etc...
    I'm planning on asking for a CC membership, but wanted to check out the new features first....
    Thanks!

Maybe you are looking for