Index: /applications/editors/josm/plugins/opendata/LGPL-2.1.txt
===================================================================
--- /applications/editors/josm/plugins/opendata/LGPL-2.1.txt	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/LGPL-2.1.txt	(revision 29679)
@@ -0,0 +1,513 @@
+      GNU LESSER GENERAL PUBLIC LICENSE
+           Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+          Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+
+      GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+          NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+         END OF TERMS AND CONDITIONS
+
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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.1 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
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
Index: /applications/editors/josm/plugins/opendata/README
===================================================================
--- /applications/editors/josm/plugins/opendata/README	(revision 29678)
+++ /applications/editors/josm/plugins/opendata/README	(revision 29679)
@@ -22,4 +22,5 @@
         - commons/lang3: Apache Commons Lang 3.1 (stuff related to WordUtils, used by the plugin itself)
         - poi: Apache POI 3.7 (Excel format support without styles, formulas and writing capabilities, used by the plugin itself)
+    - org/j7zip: J7zip 4.43alpha2 (7z archive read support, LGPL v2.1, see LGPL-2.1.txt)
     - org/jopendocument: jOpenDocument 1.2 (ODS support without styles and writing capabilities, used by the plugin itself) (GPL v3, see GPL-3.0.txt)
     
Index: /applications/editors/josm/plugins/opendata/build.xml
===================================================================
--- /applications/editors/josm/plugins/opendata/build.xml	(revision 29678)
+++ /applications/editors/josm/plugins/opendata/build.xml	(revision 29679)
@@ -58,4 +58,13 @@
     <!--
     **********************************************************
+    ** compile_j7zip - compiles J7zip classes
+    **********************************************************
+    -->
+    <target name="compile_j7zip" depends="init">
+        <echo message="compiling J7Zip ... "/>
+        <javac srcdir="includes/org/j7zip" debug="true" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="UTF-8" />
+    </target>
+    <!--
+    **********************************************************
     ** compile_neptune - compiles Neptune classes
     **********************************************************
@@ -70,5 +79,5 @@
     **********************************************************
     -->
-    <target name="compile" depends="init, compile_lang3, compile_poi, compile_jopendoc, compile_neptune">
+    <target name="compile" depends="init, compile_lang3, compile_poi, compile_jopendoc, compile_neptune, compile_j7zip">
         <echo message="compiling sources for  ${plugin.jar} ... "/>
         <javac srcdir="src" debug="true" destdir="${plugin.build.dir}" includeAntRuntime="false">
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/BoolVector.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/BoolVector.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/BoolVector.java	(revision 29679)
@@ -0,0 +1,52 @@
+package org.j7zip.Common;
+
+public class BoolVector {
+    
+    protected boolean[] data = new boolean[10];
+    int capacityIncr = 10;
+    int elt = 0;
+    
+    public BoolVector() {
+    }
+    
+    public int size() {
+        return elt;
+    }
+    
+    private void ensureCapacity(int minCapacity) {
+        int oldCapacity = data.length;
+        if (minCapacity > oldCapacity) {
+            boolean [] oldData = data;
+            int newCapacity = oldCapacity + capacityIncr;
+            if (newCapacity < minCapacity) {
+                newCapacity = minCapacity;
+            }
+            data = new boolean[newCapacity];
+            System.arraycopy(oldData, 0, data, 0, elt);
+        }
+    }
+    
+    public boolean get(int index) {
+        if (index >= elt)
+            throw new ArrayIndexOutOfBoundsException(index);
+        
+        return data[index];
+    }
+    
+    public void Reserve(int s) {
+        ensureCapacity(s);
+    }
+    
+    public void add(boolean b) {
+        ensureCapacity(elt + 1);
+        data[elt++] = b;
+    }
+    
+    public void clear() {
+        elt = 0;
+    }
+    
+    public boolean isEmpty() {
+        return elt == 0;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/ByteBuffer.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/ByteBuffer.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/ByteBuffer.java	(revision 29679)
@@ -0,0 +1,36 @@
+package org.j7zip.Common;
+
+public class ByteBuffer {
+    int _capacity;
+    byte [] _items;
+    
+    public ByteBuffer() {
+        _capacity = 0;
+        _items = null;
+    }
+    
+    public byte [] data() { return _items; }
+    
+    public int GetCapacity() { return  _capacity; }
+    
+    public void SetCapacity(int newCapacity) {
+        if (newCapacity == _capacity)
+            return;
+        
+        byte [] newBuffer;
+        if (newCapacity > 0) {
+            newBuffer = new byte[newCapacity];
+            if(_capacity > 0) {
+                int len = _capacity;
+                if (newCapacity < len) len = newCapacity;
+                
+                System.arraycopy(_items,0,newBuffer,0,len); // for (int i = 0 ; i < len ; i++) newBuffer[i] = _items[i];
+            }
+        } else
+            newBuffer = null;
+        
+        // delete []_items;
+        _items = newBuffer;
+        _capacity = newCapacity;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/CRC.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/CRC.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/CRC.java	(revision 29679)
@@ -0,0 +1,67 @@
+package org.j7zip.Common;
+
+public class CRC {
+    static public int[] Table = new int[256];
+    
+    static
+    {
+        for (int i = 0; i < 256; i++) {
+            int r = i;
+            for (int j = 0; j < 8; j++)
+                if ((r & 1) != 0)
+                    r = (r >>> 1) ^ 0xEDB88320;
+                else
+                    r >>>= 1;
+            Table[i] = r;
+        }
+    }
+    
+    int _value = -1;
+    
+    public void Init() {
+        _value = -1;
+    }
+    
+    public void UpdateByte(int b) {
+        _value = Table[(_value ^ b) & 0xFF] ^ (_value >>> 8);
+    }
+    
+    public void UpdateUInt32(int v) {
+        for (int i = 0; i < 4; i++)
+            UpdateByte((v >> (8 * i)) & 0xFF );
+    }
+    
+    public void UpdateUInt64(long v) {
+        for (int i = 0; i < 8; i++)
+            UpdateByte((int)((v >> (8 * i))) & 0xFF);
+    }
+    
+    public int GetDigest() {
+        return _value ^ (-1);
+    }
+    
+    public void Update(byte[] data, int size) {
+        for (int i = 0; i < size; i++)
+            _value = Table[(_value ^ data[i]) & 0xFF] ^ (_value >>> 8);
+    }
+    
+    public void Update(byte[] data) {
+        for (int i = 0; i < data.length; i++)
+            _value = Table[(_value ^ data[i]) & 0xFF] ^ (_value >>> 8);
+    }
+    
+    public void Update(byte[] data, int offset, int size) {
+        for (int i = 0; i < size; i++)
+            _value = Table[(_value ^ data[offset + i]) & 0xFF] ^ (_value >>> 8);
+    }
+    
+    public static int CalculateDigest(byte [] data, int size) {
+        CRC crc = new CRC();
+        crc.Update(data, size);
+        return crc.GetDigest();
+    }
+    
+    static public boolean VerifyDigest(int digest, byte [] data, int size) {
+        return (CalculateDigest(data, size) == digest);
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/IntVector.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/IntVector.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/IntVector.java	(revision 29679)
@@ -0,0 +1,85 @@
+package org.j7zip.Common;
+
+public class IntVector {
+    protected int[] data = new int[10];
+    int capacityIncr = 10;
+    int elt = 0;
+    
+    public IntVector() {
+    }
+    
+    public int size() {
+        return elt;
+    }
+    
+    private void ensureCapacity(int minCapacity) {
+        int oldCapacity = data.length;
+        if (minCapacity > oldCapacity) {
+            int [] oldData = data;
+            int newCapacity = oldCapacity + capacityIncr;
+            if (newCapacity < minCapacity) {
+                newCapacity = minCapacity;
+            }
+            data = new int[newCapacity];
+            System.arraycopy(oldData, 0, data, 0, elt);
+        }
+    }
+    
+    public int get(int index) {
+        if (index >= elt)
+            throw new ArrayIndexOutOfBoundsException(index);
+        
+        return data[index];
+    }
+    
+    public void Reserve(int s) {
+        ensureCapacity(s);
+    }
+    
+    public void add(int b) {
+        ensureCapacity(elt + 1);
+        data[elt++] = b;
+    }
+    
+    public void clear() {
+        elt = 0;
+    }
+    
+    public boolean isEmpty() {
+        return elt == 0;
+    }
+    
+    public int Back() {
+        if (elt < 1)
+            throw new ArrayIndexOutOfBoundsException(0);
+        
+        return data[elt-1];
+    }
+    
+    public int Front() {
+        if (elt < 1)
+            throw new ArrayIndexOutOfBoundsException(0);
+        
+        return data[0];
+    }
+    
+    public void DeleteBack() {
+        // Delete(_size - 1);
+        remove(elt-1);
+    }
+    
+    public int remove(int index) {
+        if (index >= elt)
+            throw new ArrayIndexOutOfBoundsException(index);
+        int oldValue = data[index];
+        
+        int numMoved = elt - index - 1;
+        if (numMoved > 0)
+            System.arraycopy(elt, index+1, elt, index,numMoved);
+        
+        // data[--elt] = null; // Let gc do its work
+        
+        return oldValue;
+    }
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LimitedSequentialInStream.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LimitedSequentialInStream.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LimitedSequentialInStream.java	(revision 29679)
@@ -0,0 +1,47 @@
+package org.j7zip.Common;
+
+public class LimitedSequentialInStream extends java.io.InputStream {
+    java.io.InputStream _stream; // ISequentialInStream
+    long _size;
+    long _pos;
+    boolean _wasFinished;
+    
+    public LimitedSequentialInStream() {
+    }
+    
+    public void SetStream(java.io.InputStream stream) { // ISequentialInStream
+        _stream = stream;
+    }
+    
+    public void Init(long streamSize) {
+        _size = streamSize;
+        _pos = 0;
+        _wasFinished = false;
+    }
+    
+    public int read() throws java.io.IOException {
+        int ret = _stream.read();
+        if (ret == -1) _wasFinished = true;
+        return ret;
+    }
+    
+    public int read(byte [] data,int off, int size) throws java.io.IOException {
+        long sizeToRead2 = (_size - _pos);
+        if (size < sizeToRead2) sizeToRead2 = size;
+        
+        int sizeToRead = (int)sizeToRead2;
+        
+        if (sizeToRead > 0) {
+            int realProcessedSize = _stream.read(data, off, sizeToRead);
+            if (realProcessedSize == -1) {
+                _wasFinished = true;
+                return -1;
+            }
+            _pos += realProcessedSize;
+            return realProcessedSize;
+        }
+        
+        return -1; // EOF
+    }
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LockedInStream.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LockedInStream.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LockedInStream.java	(revision 29679)
@@ -0,0 +1,35 @@
+package org.j7zip.Common;
+
+import org.j7zip.SevenZip.IInStream;
+
+public class LockedInStream {
+    IInStream _stream;
+    
+    public LockedInStream() {
+    }
+    
+    public void Init(IInStream stream) {
+        _stream = stream;
+    }
+    
+    /* really too slow, don't use !
+    public synchronized int read(long startPos) throws java.io.IOException
+    {
+        // NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+        _stream.Seek(startPos, IInStream.STREAM_SEEK_SET);
+        return _stream.read();
+    }
+     */
+    
+    public synchronized int read(long startPos, byte  [] data, int size) throws java.io.IOException {
+        // NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+        _stream.Seek(startPos, IInStream.STREAM_SEEK_SET);
+        return _stream.read(data,0, size);
+    }
+    
+    public synchronized int read(long startPos, byte  [] data, int off, int size) throws java.io.IOException {
+        // NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+        _stream.Seek(startPos, IInStream.STREAM_SEEK_SET);
+        return _stream.read(data,off, size);
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LockedSequentialInStreamImp.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LockedSequentialInStreamImp.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LockedSequentialInStreamImp.java	(revision 29679)
@@ -0,0 +1,36 @@
+package org.j7zip.Common;
+
+public class LockedSequentialInStreamImp extends java.io.InputStream {
+    LockedInStream _lockedInStream;
+    long _pos;
+    
+    public LockedSequentialInStreamImp() {
+    }
+    
+    public void Init(LockedInStream lockedInStream, long startPos) {
+        _lockedInStream = lockedInStream;
+        _pos = startPos;
+    }
+    
+    public int read() throws java.io.IOException {
+        throw new java.io.IOException("LockedSequentialInStreamImp : read() not implemented");
+        /*
+        int ret = _lockedInStream.read(_pos);
+        if (ret == -1) return -1; // EOF
+         
+        _pos += 1;
+         
+        return ret;
+         */
+    }
+    
+    public int read(byte [] data, int off, int size) throws java.io.IOException {
+        int realProcessedSize = _lockedInStream.read(_pos, data,off, size);
+        if (realProcessedSize == -1) return -1; // EOF
+        
+        _pos += realProcessedSize;
+        
+        return realProcessedSize;
+    }
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LongVector.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LongVector.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/LongVector.java	(revision 29679)
@@ -0,0 +1,85 @@
+package org.j7zip.Common;
+
+public class LongVector {
+    protected long[] data = new long[10];
+    int capacityIncr = 10;
+    int elt = 0;
+    
+    public LongVector() {
+    }
+    
+    public int size() {
+        return elt;
+    }
+    
+    private void ensureCapacity(int minCapacity) {
+        int oldCapacity = data.length;
+        if (minCapacity > oldCapacity) {
+            long [] oldData = data;
+            int newCapacity = oldCapacity + capacityIncr;
+            if (newCapacity < minCapacity) {
+                newCapacity = minCapacity;
+            }
+            data = new long[newCapacity];
+            System.arraycopy(oldData, 0, data, 0, elt);
+        }
+    }
+    
+    public long get(int index) {
+        if (index >= elt)
+            throw new ArrayIndexOutOfBoundsException(index);
+        
+        return data[index];
+    }
+    
+    public void Reserve(int s) {
+        ensureCapacity(s);
+    }
+    
+    public void add(long b) {
+        ensureCapacity(elt + 1);
+        data[elt++] = b;
+    }
+    
+    public void clear() {
+        elt = 0;
+    }
+    
+    public boolean isEmpty() {
+        return elt == 0;
+    }
+    
+    public long Back() {
+        if (elt < 1)
+            throw new ArrayIndexOutOfBoundsException(0);
+        
+        return data[elt-1];
+    }
+    
+    public long Front() {
+        if (elt < 1)
+            throw new ArrayIndexOutOfBoundsException(0);
+        
+        return data[0];
+    }
+    
+    public void DeleteBack() {
+        // Delete(_size - 1);
+        remove(elt-1);
+    }
+    
+    public long remove(int index) {
+        if (index >= elt)
+            throw new ArrayIndexOutOfBoundsException(index);
+        long oldValue = data[index];
+        
+        int numMoved = elt - index - 1;
+        if (numMoved > 0)
+            System.arraycopy(elt, index+1, elt, index,numMoved);
+        
+        // data[--elt] = null; // Let gc do its work
+        
+        return oldValue;
+    }
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/ObjectVector.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/ObjectVector.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/ObjectVector.java	(revision 29679)
@@ -0,0 +1,24 @@
+package org.j7zip.Common;
+
+public class ObjectVector<E> extends java.util.Vector<E>
+{
+    public ObjectVector() {
+        super();
+    }
+    
+    public void Reserve(int s) {
+        ensureCapacity(s);
+    }
+    
+    public E Back() {
+        return get(elementCount-1);
+    }
+    
+    public E Front() {
+        return get(0);
+    }
+    
+    public void DeleteBack() {
+        remove(elementCount-1);
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/RecordVector.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/RecordVector.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/Common/RecordVector.java	(revision 29679)
@@ -0,0 +1,24 @@
+package org.j7zip.Common;
+
+public class RecordVector<E> extends java.util.Vector<E>
+{
+    public RecordVector() {
+        super();
+    }
+    
+    public void Reserve(int s) {
+        ensureCapacity(s);
+    }
+    
+    public E Back() {
+        return get(elementCount-1);
+    }
+    
+    public E Front() {
+        return get(0);
+    }
+    
+    public void DeleteBack() {
+        remove(elementCount-1);
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/BindInfo.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/BindInfo.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/BindInfo.java	(revision 29679)
@@ -0,0 +1,83 @@
+package org.j7zip.SevenZip.Archive.Common;
+
+import org.j7zip.Common.IntVector;
+import org.j7zip.Common.RecordVector;
+
+public class BindInfo {
+    public RecordVector<CoderStreamsInfo> Coders = new RecordVector<CoderStreamsInfo>();
+    public RecordVector<BindPair> BindPairs = new RecordVector<BindPair>();
+    public IntVector InStreams = new IntVector();
+    public IntVector OutStreams = new IntVector();
+    
+    public void Clear() {
+        Coders.clear();
+        BindPairs.clear();
+        InStreams.clear();
+        OutStreams.clear();
+    }
+      
+    public int FindBinderForInStream(int inStream) // const
+    {
+        for (int i = 0; i < BindPairs.size(); i++)
+            if (BindPairs.get(i).InIndex == inStream)
+                return i;
+        return -1;
+    }
+    
+    public int FindBinderForOutStream(int outStream) // const
+    {
+        for (int i = 0; i < BindPairs.size(); i++)
+            if (BindPairs.get(i).OutIndex == outStream)
+                return i;
+        return -1;
+    }
+    
+    public int GetCoderInStreamIndex(int coderIndex) // const
+    {
+        int streamIndex = 0;
+        for (int i = 0; i < coderIndex; i++)
+            streamIndex += Coders.get(i).NumInStreams;
+        return streamIndex;
+    }
+    
+    public int GetCoderOutStreamIndex(int coderIndex) // const
+    {
+        int streamIndex = 0;
+        for (int i = 0; i < coderIndex; i++)
+            streamIndex += Coders.get(i).NumOutStreams;
+        return streamIndex;
+    }
+    
+    public void FindInStream(int streamIndex,
+            int [] coderIndex, // UInt32 &coderIndex
+            int [] coderStreamIndex // UInt32 &coderStreamIndex
+            )
+            
+    {
+        for (coderIndex[0] = 0; coderIndex[0] < Coders.size(); coderIndex[0]++) {
+            int curSize = Coders.get(coderIndex[0]).NumInStreams;
+            if (streamIndex < curSize) {
+                coderStreamIndex[0] = streamIndex;
+                return;
+            }
+            streamIndex -= curSize;
+        }
+        throw new UnknownError("1");
+    }
+    
+    public void FindOutStream(int streamIndex,
+            int [] coderIndex, // UInt32 &coderIndex,
+            int [] coderStreamIndex /* , UInt32 &coderStreamIndex */ ) {
+        for (coderIndex[0] = 0; coderIndex[0] < Coders.size(); coderIndex[0]++) {
+            int curSize = Coders.get(coderIndex[0]).NumOutStreams;
+            if (streamIndex < curSize) {
+                coderStreamIndex[0] = streamIndex;
+                return;
+            }
+            streamIndex -= curSize;
+        }
+        throw new UnknownError("1");
+    }
+    
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/BindPair.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/BindPair.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/BindPair.java	(revision 29679)
@@ -0,0 +1,11 @@
+package org.j7zip.SevenZip.Archive.Common;
+
+public class BindPair {
+    public int InIndex;
+    public int OutIndex;
+    
+    public BindPair() {
+        InIndex = 0;
+        OutIndex = 0;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderInfo.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderInfo.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderInfo.java	(revision 29679)
@@ -0,0 +1,55 @@
+package org.j7zip.SevenZip.Archive.Common;
+
+import org.j7zip.Common.LongVector;
+import org.j7zip.SevenZip.ICompressCoder;
+import org.j7zip.SevenZip.ICompressCoder2;
+
+
+public class CoderInfo {
+    ICompressCoder Coder;
+    ICompressCoder2 Coder2;
+    int NumInStreams;
+    int NumOutStreams;
+    
+    LongVector InSizes = new LongVector();
+    LongVector OutSizes = new LongVector();
+    LongVector InSizePointers = new LongVector();
+    LongVector OutSizePointers = new LongVector();
+    
+    public CoderInfo(int numInStreams, int numOutStreams) {
+        NumInStreams = numInStreams;
+        NumOutStreams = numOutStreams;
+        InSizes.Reserve(NumInStreams);
+        InSizePointers.Reserve(NumInStreams);
+        OutSizePointers.Reserve(NumOutStreams);
+        OutSizePointers.Reserve(NumOutStreams);
+    }
+    
+    static public void SetSizes(
+            LongVector srcSizes,
+            LongVector sizes,
+            LongVector sizePointers,
+            int numItems)
+    {
+        sizes.clear();
+        sizePointers.clear();
+        for(int i = 0; i < numItems; i++) {
+            if (srcSizes == null || srcSizes.get(i) == -1)  // TBD null => -1
+            {
+                sizes.add(new Long(0));
+                sizePointers.add(-1);
+            } else {
+                sizes.add(srcSizes.get(i)); // sizes.Add(*srcSizes[i]);
+                sizePointers.add(sizes.Back()); // sizePointers.Add(&sizes.Back());
+            }
+        }
+    }
+    
+    public void SetCoderInfo(
+            LongVector inSizes, //  const UInt64 **inSizes,
+            LongVector outSizes) //const UInt64 **outSizes)
+    {
+        SetSizes(inSizes, InSizes, InSizePointers, NumInStreams);
+        SetSizes(outSizes, OutSizes, OutSizePointers, NumOutStreams);
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderMixer2.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderMixer2.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderMixer2.java	(revision 29679)
@@ -0,0 +1,12 @@
+package org.j7zip.SevenZip.Archive.Common;
+
+import org.j7zip.Common.LongVector;
+
+public interface CoderMixer2 {
+    
+    void ReInit();
+
+    void SetBindInfo(BindInfo bindInfo);
+
+    void SetCoderInfo(int coderIndex,LongVector inSizes, LongVector outSizes);
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderMixer2ST.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderMixer2ST.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderMixer2ST.java	(revision 29679)
@@ -0,0 +1,278 @@
+package org.j7zip.SevenZip.Archive.Common;
+
+
+import java.io.IOException;
+
+import org.j7zip.Common.LongVector;
+import org.j7zip.Common.ObjectVector;
+import org.j7zip.Common.RecordVector;
+import org.j7zip.SevenZip.HRESULT;
+import org.j7zip.SevenZip.ICompressCoder;
+import org.j7zip.SevenZip.ICompressCoder2;
+import org.j7zip.SevenZip.ICompressProgressInfo;
+import org.j7zip.SevenZip.ICompressSetInStream;
+import org.j7zip.SevenZip.ICompressSetOutStream;
+import org.j7zip.SevenZip.ICompressSetOutStreamSize;
+
+
+
+public class CoderMixer2ST implements ICompressCoder2 , CoderMixer2 {
+    
+    BindInfo _bindInfo = new BindInfo();
+    ObjectVector<STCoderInfo> _coders = new ObjectVector<STCoderInfo>();
+    int _mainCoderIndex;
+    
+    public CoderMixer2ST() {
+    }
+    
+    
+    public void SetBindInfo(BindInfo bindInfo) {
+        _bindInfo = bindInfo;
+    }
+    
+    public void AddCoderCommon(boolean isMain) {
+        CoderStreamsInfo csi = _bindInfo.Coders.get(_coders.size());
+        _coders.add(new STCoderInfo(csi.NumInStreams, csi.NumOutStreams, isMain));
+    }
+    
+    public void AddCoder2(ICompressCoder2 coder, boolean isMain) {
+        AddCoderCommon(isMain);
+        _coders.Back().Coder2 = coder;
+    }
+    
+    public void AddCoder(ICompressCoder coder, boolean isMain) {
+        AddCoderCommon(isMain);
+        _coders.Back().Coder = coder;
+    }
+    
+    public void ReInit() {
+    }
+    
+    public void SetCoderInfo(int coderIndex,LongVector inSizes, LongVector outSizes) {
+        // _coders[coderIndex].SetCoderInfo(inSizes, outSizes);
+        _coders.get(coderIndex).SetCoderInfo(inSizes, outSizes);
+    }
+    
+    public int GetInStream(
+            RecordVector<java.io.InputStream> inStreams,
+            Object useless_inSizes, // const UInt64 **inSizes,
+            int streamIndex,
+            java.io.InputStream [] inStreamRes) {
+        java.io.InputStream seqInStream;
+        int i;
+        for(i = 0; i < _bindInfo.InStreams.size(); i++)
+            if (_bindInfo.InStreams.get(i) == streamIndex) {
+            seqInStream = inStreams.get(i);
+            inStreamRes[0] = seqInStream; // seqInStream.Detach();
+            return  HRESULT.S_OK;
+            }
+        int binderIndex = _bindInfo.FindBinderForInStream(streamIndex);
+        if (binderIndex < 0)
+            return HRESULT.E_INVALIDARG;
+        
+        
+        int tmp1 [] = new int[1]; // TBD
+        int tmp2 [] = new int[1]; // TBD
+        _bindInfo.FindOutStream(_bindInfo.BindPairs.get(binderIndex).OutIndex,
+                tmp1 /* coderIndex */ , tmp2 /* coderStreamIndex */ );
+        int coderIndex = tmp1[0], coderStreamIndex = tmp2[0];
+        
+        CoderInfo coder = _coders.get(coderIndex);
+        if (coder.Coder == null)
+            return HRESULT.E_NOTIMPL;
+        
+        seqInStream = (java.io.InputStream)coder.Coder; // coder.Coder.QueryInterface(IID_ISequentialInStream, &seqInStream);
+        if (seqInStream == null)
+            return HRESULT.E_NOTIMPL;
+        
+        int startIndex = _bindInfo.GetCoderInStreamIndex(coderIndex);
+        
+        if (coder.Coder == null)
+            return HRESULT.E_NOTIMPL;
+        
+        ICompressSetInStream setInStream = (ICompressSetInStream)coder.Coder; //  coder.Coder.QueryInterface(IID_ICompressSetInStream, &setInStream);
+        if (setInStream == null)
+            return HRESULT.E_NOTIMPL;
+        
+        if (coder.NumInStreams > 1)
+            return HRESULT.E_NOTIMPL;
+        for (i = 0; i < (int)coder.NumInStreams; i++) {
+            java.io.InputStream [] tmp = new java.io.InputStream[1];
+            int res = GetInStream(inStreams, useless_inSizes, startIndex + i, tmp /* &seqInStream2 */ );
+            if (res != HRESULT.S_OK) return res;
+            java.io.InputStream seqInStream2 = tmp[0];
+            res = setInStream.SetInStream(seqInStream2);
+            if (res != HRESULT.S_OK) return res;
+        }
+        inStreamRes[0] = seqInStream; // seqInStream.Detach();
+        return HRESULT.S_OK;
+    }
+    
+    public int GetOutStream(
+            RecordVector<java.io.OutputStream> outStreams,
+            Object useless_outSizes, //  const UInt64 **outSizes,
+            int streamIndex,
+            java.io.OutputStream [] outStreamRes) {
+        java.io.OutputStream seqOutStream;
+        int i;
+        for(i = 0; i < _bindInfo.OutStreams.size(); i++)
+            if (_bindInfo.OutStreams.get(i) == streamIndex) {
+            seqOutStream = outStreams.get(i);
+            outStreamRes[0] = seqOutStream; // seqOutStream.Detach();
+            return  HRESULT.S_OK;
+            }
+        int binderIndex = _bindInfo.FindBinderForOutStream(streamIndex);
+        if (binderIndex < 0)
+            return HRESULT.E_INVALIDARG;
+        
+        int tmp1[] = new int[1];
+        int tmp2[] = new int[1];
+        _bindInfo.FindInStream(_bindInfo.BindPairs.get(binderIndex).InIndex,
+                tmp1 /* coderIndex*/ , tmp2 /* coderStreamIndex */ );
+        int coderIndex = tmp1[0], coderStreamIndex = tmp2[0];
+        
+        CoderInfo coder = _coders.get(coderIndex);
+        if (coder.Coder == null)
+            return HRESULT.E_NOTIMPL;
+        
+        try
+        {
+            seqOutStream = (java.io.OutputStream)coder.Coder; // coder.Coder.QueryInterface(IID_ISequentialOutStream, &seqOutStream);
+        } catch (java.lang.ClassCastException e) {
+            return HRESULT.E_NOTIMPL;
+        }
+        
+        int startIndex = _bindInfo.GetCoderOutStreamIndex(coderIndex);
+        
+        if (coder.Coder == null)
+            return HRESULT.E_NOTIMPL;
+        
+        ICompressSetOutStream setOutStream = null;
+        try {
+            setOutStream = (ICompressSetOutStream)coder.Coder; // coder.Coder.QueryInterface(IID_ICompressSetOutStream, &setOutStream);
+        } catch (java.lang.ClassCastException e) {     
+            return HRESULT.E_NOTIMPL;
+        }
+        
+        if (coder.NumOutStreams > 1)
+            return HRESULT.E_NOTIMPL;
+        for (i = 0; i < (int)coder.NumOutStreams; i++) {
+            java.io.OutputStream [] tmp = new java.io.OutputStream[1];
+            int res = GetOutStream(outStreams, useless_outSizes, startIndex + i, tmp /* &seqOutStream2 */ );
+            if (res != HRESULT.S_OK) return res;
+            java.io.OutputStream seqOutStream2 = tmp[0];
+            res = setOutStream.SetOutStream(seqOutStream2);
+            if (res != HRESULT.S_OK) return res;
+        }
+        outStreamRes[0] = seqOutStream; // seqOutStream.Detach();
+        return HRESULT.S_OK;
+    }
+    
+    public int Code(
+            RecordVector<java.io.InputStream>  inStreams,
+            Object useless_inSizes, // const UInt64 ** inSizes ,
+            int numInStreams,
+            RecordVector<java.io.OutputStream> outStreams,
+            Object useless_outSizes, // const UInt64 ** /* outSizes */,
+            int numOutStreams,
+            ICompressProgressInfo progress) throws IOException {
+        if (numInStreams != _bindInfo.InStreams.size() ||
+                numOutStreams != _bindInfo.OutStreams.size())
+            return HRESULT.E_INVALIDARG;
+        
+        
+        // Find main coder
+        int _mainCoderIndex = -1;
+        int i;
+        for (i = 0; i < _coders.size(); i++)
+            if (_coders.get(i).IsMain) {
+            _mainCoderIndex = i;
+            break;
+            }
+        if (_mainCoderIndex < 0)
+            for (i = 0; i < _coders.size(); i++)
+                if (_coders.get(i).NumInStreams > 1) {
+            if (_mainCoderIndex >= 0)
+                return HRESULT.E_NOTIMPL;
+            _mainCoderIndex = i;
+                }
+        if (_mainCoderIndex < 0)
+            _mainCoderIndex = 0;
+        
+        // _mainCoderIndex = 0;
+        // _mainCoderIndex = _coders.Size() - 1;
+        CoderInfo mainCoder = _coders.get(_mainCoderIndex);
+        
+        ObjectVector< java.io.InputStream > seqInStreams = new ObjectVector< java.io.InputStream >(); // CObjectVector< CMyComPtr<ISequentialInStream> >
+        ObjectVector< java.io.OutputStream > seqOutStreams = new ObjectVector< java.io.OutputStream >(); // CObjectVector< CMyComPtr<ISequentialOutStream> >
+        int startInIndex = _bindInfo.GetCoderInStreamIndex(_mainCoderIndex);
+        int startOutIndex = _bindInfo.GetCoderOutStreamIndex(_mainCoderIndex);
+        for (i = 0; i < (int)mainCoder.NumInStreams; i++) {
+            java.io.InputStream tmp [] = new  java.io.InputStream[1];
+            int res = GetInStream(inStreams, useless_inSizes, startInIndex + i, tmp /* &seqInStream */ );
+            if (res != HRESULT.S_OK) return res;
+            java.io.InputStream seqInStream = tmp[0];
+            seqInStreams.add(seqInStream);
+        }
+        for (i = 0; i < (int)mainCoder.NumOutStreams; i++) {
+            java.io.OutputStream tmp [] = new  java.io.OutputStream[1];
+            int res = GetOutStream(outStreams, useless_outSizes, startOutIndex + i, tmp);
+            if (res != HRESULT.S_OK) return res;
+            java.io.OutputStream seqOutStream = tmp[0];
+            seqOutStreams.add(seqOutStream);
+        }
+        RecordVector< java.io.InputStream > seqInStreamsSpec = new RecordVector< java.io.InputStream >();
+        RecordVector< java.io.OutputStream > seqOutStreamsSpec = new RecordVector< java.io.OutputStream >();
+        for (i = 0; i < (int)mainCoder.NumInStreams; i++)
+            seqInStreamsSpec.add(seqInStreams.get(i));
+        for (i = 0; i < (int)mainCoder.NumOutStreams; i++)
+            seqOutStreamsSpec.add(seqOutStreams.get(i));
+        
+        for (i = 0; i < _coders.size(); i++) {
+            if (i == _mainCoderIndex)
+                continue;
+            CoderInfo coder = _coders.get(i);
+            
+            ICompressSetOutStreamSize setOutStreamSize = null;
+            try
+            {
+                setOutStreamSize = (ICompressSetOutStreamSize)coder.Coder;
+                
+                int res = setOutStreamSize.SetOutStreamSize(coder.OutSizePointers.get(0));
+                if (res != HRESULT.S_OK) return res;
+            } catch (java.lang.ClassCastException e) {
+                // nothing to do
+            }
+        }
+        if (mainCoder.Coder != null) {
+            int res = mainCoder.Coder.Code(
+                    seqInStreamsSpec.get(0),
+                    seqOutStreamsSpec.get(0),
+                    // TBD mainCoder.InSizePointers.get(0),
+                    mainCoder.OutSizePointers.get(0),
+                    progress);
+            if (res != HRESULT.S_OK) return res;
+        } else {
+            int res = mainCoder.Coder2.Code(
+                    seqInStreamsSpec, // &seqInStreamsSpec.Front(
+                    mainCoder.InSizePointers.Front(), // &mainCoder.InSizePointers.Front()
+                    mainCoder.NumInStreams,
+                    seqOutStreamsSpec, // &seqOutStreamsSpec.Front()
+                    mainCoder.OutSizePointers.Front(), // &mainCoder.OutSizePointers.Front()
+                    mainCoder.NumOutStreams,
+                    progress);
+            if (res != HRESULT.S_OK) return res;
+        }
+
+        
+        java.io.OutputStream stream = seqOutStreams.Front();
+        stream.flush();
+            
+        return HRESULT.S_OK;
+    }
+    
+    public void close() {
+        
+    }
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderStreamsInfo.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderStreamsInfo.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/CoderStreamsInfo.java	(revision 29679)
@@ -0,0 +1,11 @@
+package org.j7zip.SevenZip.Archive.Common;
+
+public class CoderStreamsInfo {
+    public int NumInStreams;
+    public int NumOutStreams;
+    
+    public CoderStreamsInfo() {
+        NumInStreams = 0;
+        NumOutStreams = 0;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/FilterCoder.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/FilterCoder.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/FilterCoder.java	(revision 29679)
@@ -0,0 +1,148 @@
+package org.j7zip.SevenZip.Archive.Common;
+
+
+import java.io.IOException;
+
+import org.j7zip.SevenZip.HRESULT;
+import org.j7zip.SevenZip.ICompressCoder;
+import org.j7zip.SevenZip.ICompressSetOutStream;
+
+/*
+  // #ifdef _ST_MODE
+  public ICompressSetInStream,
+  public ISequentialInStream,
+  public ICompressSetOutStream,
+  public ISequentialOutStream,
+  public IOutStreamFlush,
+  // #endif
+ */
+public class FilterCoder extends java.io.OutputStream implements ICompressCoder , ICompressSetOutStream {
+    
+    public org.j7zip.SevenZip.ICompressFilter Filter = null;
+    
+    java.io.OutputStream _outStream = null;
+    int _bufferPos;  //  UInt32
+    
+    boolean _outSizeIsDefined;
+    long _outSize;
+    long _nowPos64;
+    
+    int   Init() // HRESULT
+    {
+        _nowPos64 = 0;
+        _outSizeIsDefined = false;
+        return Filter.Init();
+    }
+    
+    // ICompressCoder
+    public int Code(
+            java.io.InputStream inStream, // , ISequentialInStream
+            java.io.OutputStream outStream, // ISequentialOutStream
+            long outSize, org.j7zip.SevenZip.ICompressProgressInfo progress) throws java.io.IOException {
+        throw new java.io.IOException("Not implemented");
+    }
+    
+    // java.io.OutputStream
+    public  void write(int b) {
+        throw new UnknownError("FilterCoder write");
+    }
+    
+    public void write(byte b[], int off, int size) throws IOException {
+        if (b == null) {
+            throw new NullPointerException();
+        } else if ((off < 0) || (off > b.length) || (size < 0) ||
+                ((off + size) > b.length) || ((off + size) < 0)) {
+            throw new IndexOutOfBoundsException();
+        } else if (size == 0) {
+            return;
+        }
+        
+        if (off != 0) throw new IOException("FilterCoder - off <> 0");
+        
+        byte [] cur_data = b;
+        int     cur_off = 0;
+        while(size > 0) {
+            int sizeMax = kBufferSize - _bufferPos;
+            int sizeTemp = size;
+            if (sizeTemp > sizeMax)
+                sizeTemp = sizeMax;
+            System.arraycopy(cur_data, cur_off,    _buffer, _bufferPos , sizeTemp); // memmove(_buffer + _bufferPos, data, sizeTemp);
+            size -= sizeTemp;
+            cur_off = cur_off + sizeTemp;
+            int endPos = _bufferPos + sizeTemp;
+            _bufferPos = Filter.Filter(_buffer, endPos);
+            if (_bufferPos == 0) {
+                _bufferPos = endPos;
+                break;
+            }
+            if (_bufferPos > endPos) {
+                if (size != 0)
+                    throw new IOException("FilterCoder - write() : size  <> 0"); // return HRESULT.E_FAIL;
+                break;
+            }
+            
+            WriteWithLimit(_outStream, _bufferPos);
+            
+            int i = 0;
+            while(_bufferPos < endPos)
+                _buffer[i++] = _buffer[_bufferPos++];
+            _bufferPos = i;
+        }
+        
+        // return HRESULT.S_OK;
+    }
+    
+    void WriteWithLimit(java.io.OutputStream outStream, int size) throws IOException {
+        if (_outSizeIsDefined) {
+            long remSize = _outSize - _nowPos64;
+            if (size > remSize)
+                size = (int)remSize;
+        }
+        
+        outStream.write(_buffer,0,size);
+        
+        _nowPos64 += size;
+    }
+    
+    byte [] _buffer;
+    
+    static final int kBufferSize = 1 << 17;
+    public FilterCoder() {
+        _buffer = new byte[kBufferSize];
+    }
+    
+    
+    // ICompressSetOutStream
+    public int SetOutStream(java.io.OutputStream outStream) {
+        _bufferPos = 0;
+        _outStream = outStream;
+        return Init();
+    }
+    
+    public int ReleaseOutStream() throws IOException {
+        if (_outStream != null) _outStream.close(); // Release()
+        _outStream = null;
+        return HRESULT.S_OK;
+    }
+    
+    public void flush() throws IOException {
+        if (_bufferPos != 0) {
+            int endPos = Filter.Filter(_buffer, _bufferPos);
+            if (endPos > _bufferPos) {
+                for (; _bufferPos < endPos; _bufferPos++)
+                    _buffer[_bufferPos] = 0;
+                if (Filter.Filter(_buffer, endPos) != endPos)
+                    throw new IOException("FilterCoder - flush() : E_FAIL"); // return HRESULT.E_FAIL;
+            }
+            _outStream.write(_buffer,0,_bufferPos);
+            _bufferPos = 0;
+        }
+        _outStream.flush();
+    }
+    
+    public void close() throws IOException {
+        if (_outStream != null) _outStream.close(); // Release()
+        _outStream = null;
+    }
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/OutStreamWithCRC.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/OutStreamWithCRC.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/OutStreamWithCRC.java	(revision 29679)
@@ -0,0 +1,55 @@
+package org.j7zip.SevenZip.Archive.Common;
+
+import org.j7zip.Common.CRC;
+
+
+public class OutStreamWithCRC extends java.io.OutputStream {
+    
+    java.io.OutputStream _stream;
+    long _size;
+    CRC _crc = new CRC();
+    boolean _calculateCrc;
+    
+    public void write(int b) throws java.io.IOException {
+        throw new java.io.IOException("OutStreamWithCRC - write() not implemented");
+    }
+    
+    public void write(byte [] data,int off, int  size) throws java.io.IOException {
+        if(_stream != null) {
+            if (size == 0) {
+                throw new java.io.IOException("size = 0");
+            } else {
+                _stream.write(data, off,size);
+            }
+        }
+        if (_calculateCrc)
+            _crc.Update(data,off, size);
+        
+        _size += size;
+    }
+    
+    public void SetStream(java.io.OutputStream stream) { _stream = stream; }
+    
+    public void Init() {
+        Init(true);
+    }
+    public void Init(boolean calculateCrc) {
+        _size = 0;
+        _calculateCrc = calculateCrc;
+        _crc.Init();
+    }
+    public void ReleaseStream() throws java.io.IOException {
+        // _stream.Release();
+        if (_stream != null) _stream.close();
+        _stream = null;
+    }
+    public long GetSize()  {
+        return _size;
+    }
+    public int GetCRC()  {
+        return _crc.GetDigest();
+    }
+    public void InitCRC() {
+        _crc.Init();
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/STCoderInfo.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/STCoderInfo.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/Common/STCoderInfo.java	(revision 29679)
@@ -0,0 +1,10 @@
+package org.j7zip.SevenZip.Archive.Common;
+
+public class STCoderInfo extends CoderInfo {
+    boolean IsMain;
+
+    public STCoderInfo(int numInStreams, int  numOutStreams, boolean isMain) {
+        super(numInStreams, numOutStreams);
+        this.IsMain = isMain;
+    }   
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/IArchiveExtractCallback.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/IArchiveExtractCallback.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/IArchiveExtractCallback.java	(revision 29679)
@@ -0,0 +1,10 @@
+package org.j7zip.SevenZip.Archive;
+
+public interface IArchiveExtractCallback extends org.j7zip.SevenZip.IProgress {
+    
+    // GetStream OUT: S_OK - OK, S_FALSE - skip this file
+    int GetStream(int index, java.io.OutputStream [] outStream,  int askExtractMode) throws java.io.IOException;
+    
+    int PrepareOperation(int askExtractMode);
+    int SetOperationResult(int resultEOperationResult) throws java.io.IOException;
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/IInArchive.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/IInArchive.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/IInArchive.java	(revision 29679)
@@ -0,0 +1,39 @@
+package org.j7zip.SevenZip.Archive;
+
+import java.io.IOException;
+
+import org.j7zip.SevenZip.IInStream;
+
+public interface IInArchive {
+    public final static int NExtract_NAskMode_kExtract = 0;
+    public final static int NExtract_NAskMode_kTest = 1;
+    public final static int NExtract_NAskMode_kSkip = 2;
+    
+    public final static int NExtract_NOperationResult_kOK = 0;
+    public final static int NExtract_NOperationResult_kUnSupportedMethod = 1;
+    public final static int NExtract_NOperationResult_kDataError = 2;
+    public final static int NExtract_NOperationResult_kCRCError = 3;
+    
+    // Static-SFX (for Linux) can be big.
+    public final long kMaxCheckStartPosition = 1 << 22;
+    
+    SevenZipEntry getEntry(int index);
+    
+    int size();
+    
+    int close() throws IOException ;
+    
+    int Extract(int [] indices, int numItems,
+            int testModeSpec, IArchiveExtractCallback extractCallbackSpec) throws java.io.IOException;
+    
+    int Open(IInStream stream) throws IOException;
+    
+    int Open(
+            IInStream stream, // InStream *stream
+            long maxCheckStartPosition // const UInt64 *maxCheckStartPosition,
+            // IArchiveOpenCallback *openArchiveCallback */
+            ) throws java.io.IOException;
+
+    
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/AltCoderInfo.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/AltCoderInfo.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/AltCoderInfo.java	(revision 29679)
@@ -0,0 +1,13 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+import org.j7zip.Common.ByteBuffer;
+
+class AltCoderInfo {
+    public MethodID MethodID;
+    public ByteBuffer Properties;
+    
+    public AltCoderInfo() {
+        MethodID = new MethodID();
+        Properties = new ByteBuffer();
+    } 
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/ArchiveDatabase.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/ArchiveDatabase.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/ArchiveDatabase.java	(revision 29679)
@@ -0,0 +1,24 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+import org.j7zip.Common.BoolVector;
+import org.j7zip.Common.IntVector;
+import org.j7zip.Common.LongVector;
+import org.j7zip.Common.ObjectVector;
+
+class ArchiveDatabase {
+    public LongVector PackSizes = new LongVector();
+    public BoolVector PackCRCsDefined = new BoolVector();
+    public IntVector PackCRCs = new IntVector();
+    public ObjectVector<Folder> Folders = new ObjectVector<Folder>();
+    public IntVector NumUnPackStreamsVector = new IntVector();
+    public ObjectVector<FileItem> Files = new ObjectVector<FileItem>();
+    
+    void Clear() {
+        PackSizes.clear();
+        PackCRCsDefined.clear();
+        PackCRCs.clear();
+        Folders.clear();
+        NumUnPackStreamsVector.clear();
+        Files.clear();
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/ArchiveDatabaseEx.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/ArchiveDatabaseEx.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/ArchiveDatabaseEx.java	(revision 29679)
@@ -0,0 +1,102 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+import org.j7zip.Common.IntVector;
+import org.j7zip.Common.LongVector;
+
+public class ArchiveDatabaseEx extends ArchiveDatabase {
+    InArchiveInfo ArchiveInfo = new InArchiveInfo();
+    LongVector PackStreamStartPositions = new LongVector();
+    IntVector FolderStartPackStreamIndex = new IntVector();
+   
+    IntVector FolderStartFileIndex = new IntVector();
+    IntVector FileIndexToFolderIndexMap = new IntVector();
+    
+    void Clear() {
+        super.Clear();
+        ArchiveInfo.Clear();
+        PackStreamStartPositions.clear();
+        FolderStartPackStreamIndex.clear();
+        FolderStartFileIndex.clear();
+        FileIndexToFolderIndexMap.clear();
+    }
+    
+    void FillFolderStartPackStream() {
+        FolderStartPackStreamIndex.clear();
+        FolderStartPackStreamIndex.Reserve(Folders.size());
+        int startPos = 0;
+        for(int i = 0; i < Folders.size(); i++) {
+            FolderStartPackStreamIndex.add(startPos);
+            startPos += Folders.get(i).PackStreams.size();
+        }
+    }
+    
+    void FillStartPos() {
+        PackStreamStartPositions.clear();
+        PackStreamStartPositions.Reserve(PackSizes.size());
+        long startPos = 0;
+        for(int i = 0; i < PackSizes.size(); i++) {
+            PackStreamStartPositions.add(startPos);
+            startPos += PackSizes.get(i);
+        }
+    }
+    
+    public void Fill()  throws java.io.IOException {
+        FillFolderStartPackStream();
+        FillStartPos();
+        FillFolderStartFileIndex();
+    }
+    
+    public long GetFolderFullPackSize(int folderIndex) {
+        int packStreamIndex = FolderStartPackStreamIndex.get(folderIndex);
+        Folder folder = Folders.get(folderIndex);
+        long size = 0;
+        for (int i = 0; i < folder.PackStreams.size(); i++)
+            size += PackSizes.get(packStreamIndex + i);
+        return size;
+    }
+    
+    
+    void FillFolderStartFileIndex() throws java.io.IOException {
+        FolderStartFileIndex.clear();
+        FolderStartFileIndex.Reserve(Folders.size());
+        FileIndexToFolderIndexMap.clear();
+        FileIndexToFolderIndexMap.Reserve(Files.size());
+        
+        int folderIndex = 0;
+        int indexInFolder = 0;
+        for (int i = 0; i < Files.size(); i++) {
+            FileItem file = Files.get(i);
+            boolean emptyStream = !file.HasStream;
+            if (emptyStream && indexInFolder == 0) {
+                FileIndexToFolderIndexMap.add(InArchive.kNumNoIndex);
+                continue;
+            }
+            if (indexInFolder == 0) {
+                // v3.13 incorrectly worked with empty folders
+                // v4.07: Loop for skipping empty folders
+                for (;;) {
+                    if (folderIndex >= Folders.size())
+                        throw new java.io.IOException("Incorrect Header"); // CInArchiveException(CInArchiveException::kIncorrectHeader);
+                    FolderStartFileIndex.add(i); // check it
+                    if (NumUnPackStreamsVector.get(folderIndex) != 0)
+                        break;
+                    folderIndex++;
+                }
+            }
+            FileIndexToFolderIndexMap.add(folderIndex);
+            if (emptyStream)
+                continue;
+            indexInFolder++;
+            if (indexInFolder >= NumUnPackStreamsVector.get(folderIndex)) {
+                folderIndex++;
+                indexInFolder = 0;
+            }
+        }
+    }
+    
+    public long GetFolderStreamPos(int folderIndex, int indexInFolder) {
+        return ArchiveInfo.DataStartPosition +
+                PackStreamStartPositions.get(FolderStartPackStreamIndex.get(folderIndex) +
+                indexInFolder);
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/BindInfoEx.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/BindInfoEx.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/BindInfoEx.java	(revision 29679)
@@ -0,0 +1,15 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+import org.j7zip.Common.RecordVector;
+import org.j7zip.SevenZip.Archive.Common.BindInfo;
+
+
+
+class BindInfoEx extends BindInfo {
+    
+    RecordVector<MethodID> CoderMethodIDs = new RecordVector<MethodID>();
+    
+    public void Clear() {
+        super.Clear(); // CBindInfo::Clear();
+        CoderMethodIDs.clear();
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/CoderInfo.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/CoderInfo.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/CoderInfo.java	(revision 29679)
@@ -0,0 +1,17 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+import org.j7zip.Common.ObjectVector;
+
+class CoderInfo {
+    
+    int NumInStreams;
+    int NumOutStreams;
+    public ObjectVector<AltCoderInfo> AltCoders = new org.j7zip.Common.ObjectVector<AltCoderInfo>();
+    
+    boolean IsSimpleCoder() { return (NumInStreams == 1) && (NumOutStreams == 1); }
+    
+    public CoderInfo() {
+        NumInStreams = 0;
+        NumOutStreams = 0;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Decoder.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Decoder.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Decoder.java	(revision 29679)
@@ -0,0 +1,374 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+import java.io.IOException;
+
+import org.j7zip.Common.ByteBuffer;
+import org.j7zip.Common.LimitedSequentialInStream;
+import org.j7zip.Common.LockedInStream;
+import org.j7zip.Common.LockedSequentialInStreamImp;
+import org.j7zip.Common.LongVector;
+import org.j7zip.Common.ObjectVector;
+import org.j7zip.Common.RecordVector;
+import org.j7zip.SevenZip.HRESULT;
+import org.j7zip.SevenZip.ICompressCoder;
+import org.j7zip.SevenZip.ICompressCoder2;
+import org.j7zip.SevenZip.ICompressFilter;
+import org.j7zip.SevenZip.ICompressSetDecoderProperties2;
+import org.j7zip.SevenZip.Archive.Common.BindPair;
+import org.j7zip.SevenZip.Archive.Common.CoderMixer2;
+import org.j7zip.SevenZip.Archive.Common.CoderMixer2ST;
+import org.j7zip.SevenZip.Archive.Common.CoderStreamsInfo;
+import org.j7zip.SevenZip.Archive.Common.FilterCoder;
+
+
+
+// import SevenZip.Archive.Common.CoderMixer2MT;
+
+
+class Decoder {
+    
+    boolean _bindInfoExPrevIsDefined;
+    BindInfoEx _bindInfoExPrev;
+    
+    boolean _multiThread;
+    
+    // CoderMixer2MT _mixerCoderMTSpec;
+    CoderMixer2ST _mixerCoderSTSpec;
+    CoderMixer2 _mixerCoderCommon;
+    
+    ICompressCoder2 _mixerCoder;
+    ObjectVector<Object> _decoders;
+    
+    public Decoder(boolean multiThread) {
+        _multiThread = multiThread;
+        _bindInfoExPrevIsDefined = false;
+        _bindInfoExPrev = new BindInfoEx();
+        
+        _mixerCoder = null;
+        _decoders = new ObjectVector<Object>();
+        
+        // #ifndef EXCLUDE_COM -- LoadMethodMap();
+    }
+    
+    static void ConvertFolderItemInfoToBindInfo(Folder folder,BindInfoEx bindInfo) {
+        bindInfo.Clear();
+        
+        for (int i = 0; i < folder.BindPairs.size(); i++) {
+            BindPair bindPair = new BindPair();
+            bindPair.InIndex = folder.BindPairs.get(i).InIndex;
+            bindPair.OutIndex = folder.BindPairs.get(i).OutIndex;
+            bindInfo.BindPairs.add(bindPair);
+        }
+        int outStreamIndex = 0;
+        for (int i = 0; i < folder.Coders.size(); i++) {
+            CoderStreamsInfo coderStreamsInfo = new CoderStreamsInfo();
+            CoderInfo coderInfo = folder.Coders.get(i);
+            coderStreamsInfo.NumInStreams = coderInfo.NumInStreams;
+            coderStreamsInfo.NumOutStreams = coderInfo.NumOutStreams;
+            bindInfo.Coders.add(coderStreamsInfo);
+            AltCoderInfo altCoderInfo = coderInfo.AltCoders.Front();
+            bindInfo.CoderMethodIDs.add(altCoderInfo.MethodID);
+            for (int j = 0; j < coderStreamsInfo.NumOutStreams; j++, outStreamIndex++)
+                if (folder.FindBindPairForOutStream(outStreamIndex) < 0)
+                    bindInfo.OutStreams.add(outStreamIndex);
+        }
+        for (int i = 0; i < folder.PackStreams.size(); i++)
+            bindInfo.InStreams.add(folder.PackStreams.get(i));
+    }
+    static boolean AreCodersEqual(CoderStreamsInfo a1, CoderStreamsInfo a2) {
+        return (a1.NumInStreams == a2.NumInStreams) &&
+                (a1.NumOutStreams == a2.NumOutStreams);
+    }
+    
+    static boolean AreBindPairsEqual(BindPair a1, BindPair a2) {
+        return (a1.InIndex == a2.InIndex) &&
+                (a1.OutIndex == a2.OutIndex);
+    }
+    
+    static boolean AreBindInfoExEqual(BindInfoEx a1, BindInfoEx a2) {
+        if (a1.Coders.size() != a2.Coders.size())
+            return false;
+        int i;
+        for (i = 0; i < a1.Coders.size(); i++)
+            if (!AreCodersEqual(a1.Coders.get(i), a2.Coders.get(i)))
+                return false;
+        if (a1.BindPairs.size() != a2.BindPairs.size())
+            return false;
+        for (i = 0; i < a1.BindPairs.size(); i++)
+            if (!AreBindPairsEqual(a1.BindPairs.get(i), a2.BindPairs.get(i)))
+                return false;
+        for (i = 0; i < a1.CoderMethodIDs.size(); i++)
+            if (a1.CoderMethodIDs.get(i) != a2.CoderMethodIDs.get(i))
+                return false;
+        if (a1.InStreams.size() != a2.InStreams.size())
+            return false;
+        if (a1.OutStreams.size() != a2.OutStreams.size())
+            return false;
+        return true;
+    }
+    
+    int Decode(org.j7zip.SevenZip.IInStream inStream,
+            long startPos,
+            LongVector packSizes, int packSizesOffset, // const UInt64 *packSizes,
+            Folder folderInfo,
+            java.io.OutputStream outStream,
+            org.j7zip.SevenZip.ICompressProgressInfo compressProgress // , // ICompressProgressInfo *compressProgress,
+            // _ST_MODE boolean mtMode, int numThreads
+            ) throws IOException {
+        
+        
+        ObjectVector<java.io.InputStream> inStreams = new ObjectVector<java.io.InputStream>(); // CObjectVector< CMyComPtr<ISequentialInStream> >
+        
+        LockedInStream lockedInStream = new LockedInStream();
+        lockedInStream.Init(inStream);
+        
+        for (int j = 0; j < folderInfo.PackStreams.size(); j++) {
+            LockedSequentialInStreamImp lockedStreamImpSpec = new LockedSequentialInStreamImp();
+            java.io.InputStream lockedStreamImp = lockedStreamImpSpec;
+            lockedStreamImpSpec.Init(lockedInStream, startPos);
+            startPos += packSizes.get(j+packSizesOffset);
+            
+            LimitedSequentialInStream streamSpec = new LimitedSequentialInStream();
+            java.io.InputStream inStream2 = streamSpec;
+            streamSpec.SetStream(lockedStreamImp);
+            streamSpec.Init(packSizes.get(j+packSizesOffset));
+            inStreams.add(inStream2);
+        }
+        
+        int numCoders = folderInfo.Coders.size();
+        
+        BindInfoEx bindInfo = new BindInfoEx();
+        ConvertFolderItemInfoToBindInfo(folderInfo, bindInfo);
+        boolean createNewCoders;
+        if (!_bindInfoExPrevIsDefined)
+            createNewCoders = true;
+        else
+            createNewCoders = !AreBindInfoExEqual(bindInfo, _bindInfoExPrev);
+        
+        
+        
+        if (createNewCoders) {
+            int i;
+            _decoders.clear();
+            
+            if (_mixerCoder != null) _mixerCoder.close(); // _mixerCoder.Release();
+            
+            if (_multiThread) {
+                /*
+                _mixerCoderMTSpec = new CoderMixer2MT();
+                _mixerCoder = _mixerCoderMTSpec;
+                _mixerCoderCommon = _mixerCoderMTSpec;
+                */
+                throw new IOException("multithreaded decoder not implemented");
+            } else {
+                _mixerCoderSTSpec = new CoderMixer2ST();
+                _mixerCoder = _mixerCoderSTSpec;
+                _mixerCoderCommon = _mixerCoderSTSpec;
+            }
+            _mixerCoderCommon.SetBindInfo(bindInfo);
+            
+            for (i = 0; i < numCoders; i++) {
+                CoderInfo coderInfo = folderInfo.Coders.get(i);
+                AltCoderInfo altCoderInfo = coderInfo.AltCoders.Front();
+                /*
+                #ifndef EXCLUDE_COM
+                        CMethodInfo methodInfo;
+                if (!GetMethodInfo(altCoderInfo.MethodID, methodInfo))
+                    return E_NOTIMPL;
+                #endif
+                 */
+                
+                if (coderInfo.IsSimpleCoder()) {
+                    ICompressCoder decoder = null;
+                    ICompressFilter filter = null;
+                    
+                    // #ifdef COMPRESS_LZMA
+                    if (altCoderInfo.MethodID.equals(MethodID.k_LZMA))
+                        decoder = new org.j7zip.SevenZip.Compression.LZMA.Decoder(); // NCompress::NLZMA::CDecoder;
+                    
+                    if (altCoderInfo.MethodID.equals(MethodID.k_PPMD))
+                        System.out.println("PPMD not implemented"); // decoder = new NCompress::NPPMD::CDecoder;
+                    
+                    if (altCoderInfo.MethodID.equals(MethodID.k_BCJ_X86))
+                        filter = new org.j7zip.SevenZip.Compression.Branch.BCJ_x86_Decoder();
+                    
+                    if (altCoderInfo.MethodID.equals(MethodID.k_Deflate))
+                        System.out.println("DEFLATE not implemented"); // decoder = new NCompress::NDeflate::NDecoder::CCOMCoder;
+                    
+                    if (altCoderInfo.MethodID.equals(MethodID.k_BZip2))
+                        System.out.println("BZIP2 not implemented"); // decoder = new NCompress::NBZip2::CDecoder;
+                    
+                    if (altCoderInfo.MethodID.equals(MethodID.k_Copy))
+                        decoder = new org.j7zip.SevenZip.Compression.Copy.Decoder(); // decoder = new NCompress::CCopyCoder;
+                    
+                    if (altCoderInfo.MethodID.equals(MethodID.k_7zAES))
+                        throw new IOException("k_7zAES not implemented"); // filter = new NCrypto::NSevenZ::CDecoder;
+                    
+                    if (filter != null) {
+                        FilterCoder coderSpec = new FilterCoder();
+                        decoder = coderSpec;
+                        coderSpec.Filter = filter;
+                    }
+                    /*
+                        #ifndef EXCLUDE_COM
+                                if (decoder == 0) {
+                            RINOK(_libraries.CreateCoderSpec(methodInfo.FilePath,
+                                    methodInfo.Decoder, &decoder));
+                                }
+                        #endif
+                     */
+                    if (decoder == null)
+                        return HRESULT.E_NOTIMPL;
+                    
+                    _decoders.add(decoder);
+                    
+                    if (_multiThread) {
+                        // _mixerCoderMTSpec.AddCoder(decoder);
+                        throw new IOException("Multithreaded decoder is not implemented");
+                    } else {
+                        _mixerCoderSTSpec.AddCoder(decoder, false);
+                    }
+                } else {
+
+                    ICompressCoder2 decoder = null;
+                     
+                    if (altCoderInfo.MethodID.equals(MethodID.k_BCJ2)) {
+                        decoder = new org.j7zip.SevenZip.Compression.Branch.BCJ2_x86_Decoder();
+                    }
+                            
+                     
+                            if (decoder == null)
+                                return HRESULT.E_NOTIMPL;
+                     
+                    _decoders.add(decoder);
+                    if (_multiThread) {
+                       // _mixerCoderMTSpec.AddCoder2(decoder);
+                       throw new IOException("Multithreaded decoder is not implemented");
+                    } else {
+                        _mixerCoderSTSpec.AddCoder2(decoder, false);
+                    }
+                }
+            }
+            _bindInfoExPrev = bindInfo;
+            _bindInfoExPrevIsDefined = true;
+        }
+        
+        int i;
+        _mixerCoderCommon.ReInit();
+        
+        int packStreamIndex = 0, unPackStreamIndex = 0;
+        int coderIndex = 0;
+        
+        for (i = 0; i < numCoders; i++) {
+            CoderInfo coderInfo = folderInfo.Coders.get(i);
+            AltCoderInfo altCoderInfo = coderInfo.AltCoders.Front();
+            Object decoder = _decoders.get(coderIndex); // CMyComPtr<IUnknown> &decoder = _decoders[coderIndex];
+            
+            {
+                try {
+                    ICompressSetDecoderProperties2 setDecoderProperties = (ICompressSetDecoderProperties2)decoder;
+                
+                    ByteBuffer properties = altCoderInfo.Properties;
+                    int size = properties.GetCapacity();
+                    if (size == -1) // (size > 0xFFFFFFFF)
+                        return HRESULT.E_NOTIMPL;
+                    if (size > 0) {
+                        boolean ret = setDecoderProperties.SetDecoderProperties2(properties.data() /* , size */ );
+                        if (ret == false) return HRESULT.E_FAIL;
+                    }
+                } catch (ClassCastException e) {
+                    // nothing to do
+                }
+            }
+            /*
+            #ifdef COMPRESS_MT
+                    if (mtMode) {
+                CMyComPtr<ICompressSetCoderMt> setCoderMt;
+                decoder.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt);
+                if (setCoderMt) {
+                    RINOK(setCoderMt->SetNumberOfThreads(numThreads));
+                }
+                    }
+            #endif
+             
+            #ifndef _NO_CRYPTO
+             {
+                CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
+                decoder.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword);
+                if (cryptoSetPassword) {
+                    if (getTextPassword == 0)
+                        return E_FAIL;
+                    CMyComBSTR password;
+                    RINOK(getTextPassword->CryptoGetTextPassword(&password));
+                    CByteBuffer buffer;
+                    UString unicodePassword(password);
+                    const UInt32 sizeInBytes = unicodePassword.Length() * 2;
+                    buffer.SetCapacity(sizeInBytes);
+                    for (int i = 0; i < unicodePassword.Length(); i++) {
+                        wchar_t c = unicodePassword[i];
+                        ((Byte *)buffer)[i * 2] = (Byte)c;
+                        ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8);
+                    }
+                    RINOK(cryptoSetPassword->CryptoSetPassword(
+                            (const Byte *)buffer, sizeInBytes));
+                }
+            }
+            #endif
+             */
+            coderIndex++;
+            
+            int numInStreams = coderInfo.NumInStreams;
+            int numOutStreams = coderInfo.NumOutStreams;
+            LongVector packSizesPointers = new LongVector(); // CRecordVector<const UInt64 *>
+            LongVector unPackSizesPointers = new LongVector(); // CRecordVector<const UInt64 *>
+            packSizesPointers.Reserve(numInStreams);
+            unPackSizesPointers.Reserve(numOutStreams);
+            int j;
+            for (j = 0; j < numOutStreams; j++, unPackStreamIndex++)
+                unPackSizesPointers.add(folderInfo.UnPackSizes.get(unPackStreamIndex));
+            
+            for (j = 0; j < numInStreams; j++, packStreamIndex++) {
+                int bindPairIndex = folderInfo.FindBindPairForInStream(packStreamIndex);
+                if (bindPairIndex >= 0)
+                    packSizesPointers.add(
+                            folderInfo.UnPackSizes.get(folderInfo.BindPairs.get(bindPairIndex).OutIndex));
+                else {
+                    int index = folderInfo.FindPackStreamArrayIndex(packStreamIndex);
+                    if (index < 0)
+                        return HRESULT.E_FAIL;
+                    packSizesPointers.add(packSizes.get(index));
+                }
+            }
+            
+            _mixerCoderCommon.SetCoderInfo(i,
+                    packSizesPointers, // &packSizesPointers.Front(),
+                    unPackSizesPointers // &unPackSizesPointers.Front()
+                    );
+        }
+        
+        int [] temp_useless = new int [1]; // TBD
+        int [] tmp1 = new int[1];
+        bindInfo.FindOutStream(bindInfo.OutStreams.get(0), tmp1 /* mainCoder */ , temp_useless /* temp */);
+        int mainCoder = tmp1[0];
+        
+        if (_multiThread) {
+           // _mixerCoderMTSpec.SetProgressCoderIndex(mainCoder);
+           throw new IOException("Multithreaded decoder is not implemented");
+        }
+        
+        if (numCoders == 0)
+            return 0;
+        RecordVector<java.io.InputStream> inStreamPointers = new RecordVector<java.io.InputStream>(); // CRecordVector<ISequentialInStream *>
+        inStreamPointers.Reserve(inStreams.size());
+        for (i = 0; i < inStreams.size(); i++)
+            inStreamPointers.add(inStreams.get(i));
+
+        RecordVector<java.io.OutputStream> outStreamPointer = new RecordVector<java.io.OutputStream>();
+        outStreamPointer.add(outStream);
+        return _mixerCoder.Code(
+                inStreamPointers, //&inStreamPointers.Front(),
+                null,
+                inStreams.size(),
+                outStreamPointer, // &outStreamPointer,
+                null, 1, compressProgress);
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/ExtractFolderInfo.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/ExtractFolderInfo.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/ExtractFolderInfo.java	(revision 29679)
@@ -0,0 +1,34 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+import org.j7zip.Common.BoolVector;
+
+
+class ExtractFolderInfo {
+  /* #ifdef _7Z_VOL
+     int VolumeIndex;
+  #endif */
+  public int FileIndex;
+  public int FolderIndex;
+  public BoolVector ExtractStatuses = new BoolVector();
+  public long UnPackSize;
+  public ExtractFolderInfo(
+    /* #ifdef _7Z_VOL
+    int volumeIndex, 
+    #endif */
+    int fileIndex, int folderIndex)  // CNum fileIndex, CNum folderIndex
+  {
+    /* #ifdef _7Z_VOL
+    VolumeIndex(volumeIndex),
+    #endif */
+    FileIndex = fileIndex;
+    FolderIndex = folderIndex;
+    UnPackSize = 0;
+
+    if (fileIndex != InArchive.kNumNoIndex)
+    {
+      ExtractStatuses.Reserve(1);
+      ExtractStatuses.add(true);
+    }
+  }
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/FileItem.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/FileItem.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/FileItem.java	(revision 29679)
@@ -0,0 +1,36 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+public class FileItem {
+    
+    public long CreationTime;
+    public long LastWriteTime;
+    public long LastAccessTime;
+    
+    public long UnPackSize;
+    public long StartPos;
+    public int Attributes;
+    public int FileCRC;
+    
+    public boolean IsDirectory;
+    public boolean IsAnti;
+    public boolean IsFileCRCDefined;
+    public boolean AreAttributesDefined;
+    public boolean HasStream;
+    // public boolean IsCreationTimeDefined; replace by (CreationTime != 0)
+    // public boolean IsLastWriteTimeDefined; replace by (LastWriteTime != 0)
+    // public boolean IsLastAccessTimeDefined; replace by (LastAccessTime != 0)
+    public boolean IsStartPosDefined;
+    public String name;
+    
+    public FileItem() {
+        HasStream = true;
+        IsDirectory = false;
+        IsAnti = false;
+        IsFileCRCDefined = false;
+        AreAttributesDefined = false;
+        CreationTime = 0; // IsCreationTimeDefined = false;
+        LastWriteTime = 0; // IsLastWriteTimeDefined = false;
+        LastAccessTime = 0; // IsLastAccessTimeDefined = false;
+        IsStartPosDefined = false;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Folder.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Folder.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Folder.java	(revision 29679)
@@ -0,0 +1,60 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+import java.io.IOException;
+
+import org.j7zip.Common.IntVector;
+import org.j7zip.Common.LongVector;
+import org.j7zip.Common.RecordVector;
+import org.j7zip.SevenZip.Archive.Common.BindPair;
+
+
+
+class Folder {
+    public RecordVector<CoderInfo> Coders = new RecordVector<CoderInfo>();
+    RecordVector<BindPair> BindPairs = new RecordVector<BindPair>();
+    IntVector PackStreams = new IntVector();
+    LongVector UnPackSizes = new LongVector();
+    int UnPackCRC;
+    boolean UnPackCRCDefined;
+    Folder() {
+        UnPackCRCDefined = false;
+    }
+
+    long GetUnPackSize() throws IOException {
+        if (UnPackSizes.isEmpty())
+            return 0;
+        for (int i = UnPackSizes.size() - 1; i >= 0; i--)
+            if (FindBindPairForOutStream(i) < 0)
+                return UnPackSizes.get(i);
+        throw new IOException("1"); // throw 1  // TBD
+    }
+    
+    int FindBindPairForInStream(int inStreamIndex) {
+        for(int i = 0; i < BindPairs.size(); i++)
+            if (BindPairs.get(i).InIndex == inStreamIndex)
+                return i;
+        return -1;
+    }
+    
+    int FindBindPairForOutStream(int outStreamIndex) {
+        for(int i = 0; i < BindPairs.size(); i++)
+            if (BindPairs.get(i).OutIndex == outStreamIndex)
+                return i;
+        return -1;
+    }
+    
+     int FindPackStreamArrayIndex(int inStreamIndex) {
+        for(int i = 0; i < PackStreams.size(); i++)
+            if (PackStreams.get(i) == inStreamIndex)
+                return i;
+        return -1;
+    }
+      
+    int GetNumOutStreams() {
+        int result = 0;
+        for (int i = 0; i < Coders.size(); i++)
+            result += Coders.get(i).NumOutStreams;
+        return result;
+    }
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/FolderOutStream.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/FolderOutStream.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/FolderOutStream.java	(revision 29679)
@@ -0,0 +1,183 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+import org.j7zip.Common.BoolVector;
+import org.j7zip.SevenZip.HRESULT;
+import org.j7zip.SevenZip.Archive.IArchiveExtractCallback;
+import org.j7zip.SevenZip.Archive.IInArchive;
+import org.j7zip.SevenZip.Archive.Common.OutStreamWithCRC;
+
+
+class FolderOutStream extends java.io.OutputStream {
+    OutStreamWithCRC _outStreamWithHashSpec;
+    java.io.OutputStream _outStreamWithHash;
+    
+    ArchiveDatabaseEx _archiveDatabase;
+    BoolVector _extractStatuses;
+    int _startIndex;
+    int _ref2Offset;
+    IArchiveExtractCallback _extractCallback;
+    boolean _testMode;
+    int _currentIndex;
+    boolean _fileIsOpen;
+   
+    long _filePos;
+
+    public FolderOutStream() {
+        _outStreamWithHashSpec = new OutStreamWithCRC();
+        _outStreamWithHash = _outStreamWithHashSpec;
+    }
+    
+    public int Init(
+            ArchiveDatabaseEx archiveDatabase,
+            int ref2Offset,
+            int startIndex,
+            BoolVector extractStatuses,
+            IArchiveExtractCallback extractCallback,
+            boolean testMode) throws java.io.IOException {
+        _archiveDatabase = archiveDatabase;
+        _ref2Offset = ref2Offset;
+        _startIndex = startIndex;
+        
+        _extractStatuses = extractStatuses;
+        _extractCallback = extractCallback;
+        _testMode = testMode;
+        
+        _currentIndex = 0;
+        _fileIsOpen = false;
+        return WriteEmptyFiles();
+    }
+    
+    int OpenFile() throws java.io.IOException {
+        int askMode;
+        if(_extractStatuses.get(_currentIndex))
+            askMode = _testMode ?
+                IInArchive.NExtract_NAskMode_kTest :
+                IInArchive.NExtract_NAskMode_kExtract;
+        else
+            askMode = IInArchive.NExtract_NAskMode_kSkip;
+        
+        
+        int index = _startIndex + _currentIndex;
+        
+        // RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode));
+        java.io.OutputStream [] realOutStream2 = new java.io.OutputStream[1]; // TBD
+        int ret = _extractCallback.GetStream(_ref2Offset + index, realOutStream2, askMode);
+        if (ret != HRESULT.S_OK) return ret;
+         
+        java.io.OutputStream realOutStream = realOutStream2[0];
+        
+        _outStreamWithHashSpec.SetStream(realOutStream);
+        _outStreamWithHashSpec.Init();
+        if (askMode == IInArchive.NExtract_NAskMode_kExtract &&
+                (realOutStream == null)) {
+            FileItem fileInfo = _archiveDatabase.Files.get(index);
+            if (!fileInfo.IsAnti && !fileInfo.IsDirectory)
+                askMode = IInArchive.NExtract_NAskMode_kSkip;
+        }
+        return _extractCallback.PrepareOperation(askMode);
+    }
+    
+    int WriteEmptyFiles() throws java.io.IOException {
+        for(;_currentIndex < _extractStatuses.size(); _currentIndex++) {
+            int index = _startIndex + _currentIndex;
+            FileItem fileInfo = _archiveDatabase.Files.get(index);
+            if (!fileInfo.IsAnti && !fileInfo.IsDirectory && fileInfo.UnPackSize != 0)
+                return HRESULT.S_OK;
+            int res = OpenFile();
+            if (res != HRESULT.S_OK) return res;
+            
+            res = _extractCallback.SetOperationResult(
+                    IInArchive.NExtract_NOperationResult_kOK);
+            if (res != HRESULT.S_OK) return res;
+            _outStreamWithHashSpec.ReleaseStream();
+        }
+        return HRESULT.S_OK;
+    }
+    
+    public void write(int b) throws java.io.IOException {
+        throw new java.io.IOException("FolderOutStream - write() not implemented");
+    }
+    
+    public void write(byte [] data,int off,  int size) throws java.io.IOException //  UInt32 *processedSize
+    {
+        int realProcessedSize = 0;
+        while(_currentIndex < _extractStatuses.size()) {
+            if (_fileIsOpen) {
+                int index = _startIndex + _currentIndex;
+                FileItem fileInfo = _archiveDatabase.Files.get(index);
+                long fileSize = fileInfo.UnPackSize;
+                
+                long numBytesToWrite2 = (int)(fileSize - _filePos);
+                int tmp = size - realProcessedSize;
+                if (tmp < numBytesToWrite2) numBytesToWrite2 = tmp;
+                
+                int numBytesToWrite = (int)numBytesToWrite2;
+                
+                int processedSizeLocal;
+                // int res = _outStreamWithHash.Write((const Byte *)data + realProcessedSize,numBytesToWrite, &processedSizeLocal));
+                // if (res != HRESULT.S_OK) throw new java.io.IOException("_outStreamWithHash.Write : " + res); // return res;
+                processedSizeLocal = numBytesToWrite;
+                _outStreamWithHash.write(data,realProcessedSize + off,numBytesToWrite);
+                
+                _filePos += processedSizeLocal;
+                realProcessedSize += processedSizeLocal;
+
+                if (_filePos == fileSize) {
+                    boolean digestsAreEqual;
+                    if (fileInfo.IsFileCRCDefined)
+                        digestsAreEqual = (fileInfo.FileCRC == _outStreamWithHashSpec.GetCRC());
+                    else
+                        digestsAreEqual = true;
+
+                    int res = _extractCallback.SetOperationResult(
+                            digestsAreEqual ?
+                                IInArchive.NExtract_NOperationResult_kOK :
+                                IInArchive.NExtract_NOperationResult_kCRCError);
+                    if (res != HRESULT.S_OK) throw new java.io.IOException("_extractCallback.SetOperationResult : " + res); // return res;
+                    
+                    _outStreamWithHashSpec.ReleaseStream();
+                    _fileIsOpen = false;
+                    _currentIndex++;
+                }
+                if (realProcessedSize == size) {
+                    int res = WriteEmptyFiles();
+                    if (res != HRESULT.S_OK) throw new java.io.IOException("WriteEmptyFiles : " + res); // return res;
+                    return ;// return realProcessedSize;
+                }
+            } else {
+                int res = OpenFile();
+                if (res != HRESULT.S_OK) throw new java.io.IOException("OpenFile : " + res); // return res;
+                _fileIsOpen = true;
+                _filePos = 0;
+            }
+        }
+        
+        // return size;
+    }
+    
+    public int FlushCorrupted(int resultEOperationResult) throws java.io.IOException {
+        while(_currentIndex < _extractStatuses.size()) {
+            if (_fileIsOpen) {
+                int res = _extractCallback.SetOperationResult(resultEOperationResult);
+                if (res != HRESULT.S_OK) return res;
+                
+                _outStreamWithHashSpec.ReleaseStream();
+                _fileIsOpen = false;
+                _currentIndex++;
+            } else {
+                int res = OpenFile();
+                if (res != HRESULT.S_OK) return res;
+                _fileIsOpen = true;
+            }
+        }
+        return HRESULT.S_OK;
+    }
+    
+    public int WasWritingFinished() {
+        int val = _extractStatuses.size();
+        if (_currentIndex == val)
+            return HRESULT.S_OK;
+        return HRESULT.E_FAIL;
+    }
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Handler.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Handler.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Handler.java	(revision 29679)
@@ -0,0 +1,466 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+import java.io.IOException;
+
+import org.j7zip.Common.ObjectVector;
+import org.j7zip.SevenZip.HRESULT;
+import org.j7zip.SevenZip.ICompressProgressInfo;
+import org.j7zip.SevenZip.IInStream;
+import org.j7zip.SevenZip.Archive.IArchiveExtractCallback;
+import org.j7zip.SevenZip.Archive.IInArchive;
+import org.j7zip.SevenZip.Archive.SevenZipEntry;
+import org.j7zip.SevenZip.Common.LocalCompressProgressInfo;
+import org.j7zip.SevenZip.Common.LocalProgress;
+
+
+
+
+
+
+public class Handler implements org.j7zip.SevenZip.Archive.IInArchive {
+    
+    // useless LongVector _fileInfoPopIDs = new LongVector();
+    
+    IInStream _inStream;
+    
+    ArchiveDatabaseEx _database;
+    
+    int _numThreads;
+    
+    public Handler() {
+        _numThreads = 1; // TBD
+        
+        _database = new ArchiveDatabaseEx();
+        
+    }
+    
+    public int Open(IInStream stream) throws IOException {
+        return Open(stream,kMaxCheckStartPosition);
+    }
+    
+    
+    public int Open(
+            IInStream stream, // InStream *stream
+            long maxCheckStartPosition // const UInt64 *maxCheckStartPosition,
+            // IArchiveOpenCallback *openArchiveCallback */
+            ) throws IOException {
+        close();
+        
+        // useless _fileInfoPopIDs.clear();
+        // TBD try
+        {
+            // TBD CMyComPtr<IArchiveOpenCallback> openArchiveCallbackTemp = openArchiveCallback;
+            
+            /* TBD
+            CMyComPtr<ICryptoGetTextPassword> getTextPassword;
+            if (openArchiveCallback)
+            {
+              openArchiveCallbackTemp.QueryInterface(
+                  IID_ICryptoGetTextPassword, &getTextPassword);
+            }
+             */
+            
+            InArchive archive = new InArchive();
+            int ret = archive.Open(stream, maxCheckStartPosition);
+            if (ret != HRESULT.S_OK) return ret;
+            ret = archive.ReadDatabase(_database); // getTextPassword
+            if (ret != HRESULT.S_OK) return ret;
+            _database.Fill();
+            _inStream = stream;
+        }
+        
+        // FillPopIDs(); // useless _fileInfoPopIDs
+        
+        return HRESULT.S_OK;
+    }
+    
+    public int Extract(int [] indices, int numItems,
+            int testModeSpec, IArchiveExtractCallback extractCallbackSpec) throws IOException {
+        
+        boolean testMode = (testModeSpec != 0);
+        IArchiveExtractCallback extractCallback = extractCallbackSpec;
+        long importantTotalUnPacked = 0;
+        
+        boolean allFilesMode = (numItems == -1);
+        if (allFilesMode)
+            numItems =
+                    // #ifdef _7Z_VOL
+                    // _refs.Size();
+                    // #else
+                    _database.Files.size();
+        // #endif
+        
+        if(numItems == 0)
+            return HRESULT.S_OK;
+        
+        ObjectVector<ExtractFolderInfo> extractFolderInfoVector = new ObjectVector<ExtractFolderInfo>();
+        for(int ii = 0; ii < numItems; ii++) {
+            int ref2Index = allFilesMode ? ii : indices[ii];
+            
+            {
+        /*
+      #ifdef _7Z_VOL
+      // const CRef &ref = ref2.Refs[ri];
+      const CRef &ref = _refs[ref2Index];
+         
+      int volumeIndex = ref.VolumeIndex;
+      const CVolume &volume = _volumes[volumeIndex];
+      const CArchiveDatabaseEx &database = volume.Database;
+      UInt32 fileIndex = ref.ItemIndex;
+      #else
+         */
+                ArchiveDatabaseEx database = _database;
+                int fileIndex = ref2Index;
+                //#endif
+                
+                int folderIndex = database.FileIndexToFolderIndexMap.get(fileIndex);
+                if (folderIndex == org.j7zip.SevenZip.Archive.SevenZip.InArchive.kNumNoIndex) {
+                    extractFolderInfoVector.add( new ExtractFolderInfo(
+                            // #ifdef _7Z_VOL
+                            // volumeIndex,
+                            // #endif
+                            fileIndex, org.j7zip.SevenZip.Archive.SevenZip.InArchive.kNumNoIndex));
+                    continue;
+                }
+                if (extractFolderInfoVector.isEmpty() ||
+                        folderIndex != extractFolderInfoVector.Back().FolderIndex
+        /*
+        #ifdef _7Z_VOL
+        || volumeIndex != extractFolderInfoVector.Back().VolumeIndex
+        #endif
+         */
+                        ) {
+                    extractFolderInfoVector.add( new ExtractFolderInfo(
+            /*
+            #ifdef _7Z_VOL
+            volumeIndex,
+            #endif
+             */
+                            org.j7zip.SevenZip.Archive.SevenZip.InArchive.kNumNoIndex, folderIndex));
+                    Folder folderInfo = database.Folders.get(folderIndex);
+                    long unPackSize = folderInfo.GetUnPackSize();
+                    importantTotalUnPacked += unPackSize;
+                    extractFolderInfoVector.Back().UnPackSize = unPackSize;
+                }
+                
+                ExtractFolderInfo efi = extractFolderInfoVector.Back();
+                
+                // const CFolderInfo &folderInfo = m_dam_Folders[folderIndex];
+                int startIndex = database.FolderStartFileIndex.get(folderIndex); // CNum
+                for (int index = efi.ExtractStatuses.size();
+                index <= fileIndex - startIndex; index++) {
+                    // UInt64 unPackSize = _database.Files[startIndex + index].UnPackSize;
+                    // Count partial_folder_size
+                    // efi.UnPackSize += unPackSize;
+                    // importantTotalUnPacked += unPackSize;
+                    efi.ExtractStatuses.add(index == fileIndex - startIndex);
+                }
+            }
+        }
+        
+        extractCallback.SetTotal(importantTotalUnPacked);
+        
+        Decoder decoder = new Decoder(
+                // #ifdef _ST_MODE
+                false
+                // #else
+                // true
+                // #endif
+                );
+        
+        long currentImportantTotalUnPacked = 0;
+        long totalFolderUnPacked;
+        
+        for(int i = 0; i < extractFolderInfoVector.size(); i++,
+                currentImportantTotalUnPacked += totalFolderUnPacked) {
+            ExtractFolderInfo efi = extractFolderInfoVector.get(i);
+            totalFolderUnPacked = efi.UnPackSize;
+            
+            int res = extractCallback.SetCompleted(currentImportantTotalUnPacked);
+            if (res != HRESULT.S_OK) return res;
+            
+            FolderOutStream folderOutStream = new FolderOutStream();
+            java.io.OutputStream outStream = folderOutStream;
+            
+            // #ifdef _7Z_VOL
+            // const CVolume &volume = _volumes[efi.VolumeIndex];
+            // const CArchiveDatabaseEx &database = volume.Database;
+            // #else
+            ArchiveDatabaseEx database = _database;
+            //#endif
+            
+            int startIndex; // CNum
+            if (efi.FileIndex != InArchive.kNumNoIndex)
+                startIndex = efi.FileIndex;
+            else
+                startIndex = database.FolderStartFileIndex.get(efi.FolderIndex);
+            
+            
+            int result = folderOutStream.Init(database,
+                    // #ifdef _7Z_VOL
+                    // volume.StartRef2Index,
+                    // #else
+                    0,
+                    // #endif
+                    startIndex,
+                    efi.ExtractStatuses, extractCallback, testMode);
+            
+            if (result != HRESULT.S_OK) return result;
+            
+            if (efi.FileIndex != InArchive.kNumNoIndex)
+                continue;
+            
+            int folderIndex = efi.FolderIndex; // CNum
+            Folder folderInfo = database.Folders.get(folderIndex);
+            
+            LocalProgress localProgressSpec = new LocalProgress();
+            ICompressProgressInfo progress = localProgressSpec;
+            localProgressSpec.Init(extractCallback, false);
+            
+            LocalCompressProgressInfo localCompressProgressSpec =
+                    new LocalCompressProgressInfo();
+            ICompressProgressInfo compressProgress = localCompressProgressSpec;
+            localCompressProgressSpec.Init(progress, ICompressProgressInfo.INVALID , currentImportantTotalUnPacked);
+            
+            int packStreamIndex = database.FolderStartPackStreamIndex.get(folderIndex); // CNum
+            long folderStartPackPos = database.GetFolderStreamPos(folderIndex, 0);
+            
+    /*
+    #ifndef _NO_CRYPTO
+    CMyComPtr<ICryptoGetTextPassword> getTextPassword;
+    if (extractCallback)
+      extractCallback.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword);
+    #endif
+     */
+            
+            try {
+                result = decoder.Decode(
+                        // #ifdef _7Z_VOL
+                        // volume.Stream,
+                        // #else
+                        _inStream,
+                        // #endif
+                        folderStartPackPos,
+                        database.PackSizes,  // database.PackSizes.get(packStreamIndex),
+                        packStreamIndex,
+                        folderInfo,
+                        outStream,
+                        compressProgress
+                        // #ifndef _NO_CRYPTO
+                        // , getTextPassword
+                        // #endif
+                        // #ifdef COMPRESS_MT
+                        // , true, _numThreads
+                        // #endif
+                        );
+                
+                if (result == HRESULT.S_FALSE) {
+                    result = folderOutStream.FlushCorrupted(IInArchive.NExtract_NOperationResult_kDataError);
+                    if (result != HRESULT.S_OK) return result;
+                    continue;
+                }
+                if (result == HRESULT.E_NOTIMPL) {
+                    result = folderOutStream.FlushCorrupted(IInArchive.NExtract_NOperationResult_kUnSupportedMethod);
+                    if (result != HRESULT.S_OK) return result;
+                    continue;
+                }
+                if (result != HRESULT.S_OK)
+                    return result;
+                if (folderOutStream.WasWritingFinished() != HRESULT.S_OK) {
+                    result = folderOutStream.FlushCorrupted(IInArchive.NExtract_NOperationResult_kDataError);
+                    if (result != HRESULT.S_OK) return result;
+                    continue;
+                }
+            } catch(Exception e) {
+                System.out.println("IOException : " + e);
+                e.printStackTrace();
+                result = folderOutStream.FlushCorrupted(IInArchive.NExtract_NOperationResult_kDataError);
+                if (result != HRESULT.S_OK) return result;
+                continue;
+            }
+        }
+        return HRESULT.S_OK;
+    }
+    
+    
+    public int close() throws IOException {
+/*
+        #ifdef _7Z_VOL
+        _volumes.Clear();
+        _refs.Clear();
+        #else
+        _inStream.Release();
+        _database.Clear();
+        #endif
+        return S_OK;
+ */
+        if (_inStream != null) _inStream.close();  // _inStream.Release();
+        _inStream = null;
+        _database.Clear();
+        return 0;
+    }
+    
+    public int size() {
+        return _database.Files.size();
+    }
+    
+    long getPackSize(int index2) {
+        long packSize = 0;
+        int folderIndex = _database.FileIndexToFolderIndexMap.get(index2);
+        if (folderIndex != InArchive.kNumNoIndex) {
+            if (_database.FolderStartFileIndex.get(folderIndex) == index2)
+                packSize = _database.GetFolderFullPackSize(folderIndex);
+        }
+        return packSize;
+    }
+    
+    static int GetUInt32FromMemLE(byte [] p , int off) {
+        return p[off] | (((int)p[off + 1]) << 8) | (((int)p[off + 2]) << 16) | (((int)p[off +3]) << 24);
+    }
+    
+    static String GetStringForSizeValue(int value) {
+        for (int i = 31; i >= 0; i--)
+            if ((1 << i) == value)
+                return "" + i;
+        String result = "";
+        if (value % (1 << 20) == 0) {
+            result += "" + (value >> 20);
+            result += "m";
+        } else if (value % (1 << 10) == 0) {
+            result += "" + (value >> 10);
+            result += "k";
+        } else {
+            result += "" + (value);
+            result += "b";
+        }
+        return result;
+    }
+    
+    String getMethods(int index2) {
+        String ret = "";
+        
+        int folderIndex = _database.FileIndexToFolderIndexMap.get(index2);
+        if (folderIndex != InArchive.kNumNoIndex) {
+            Folder folderInfo = _database.Folders.get(folderIndex);
+            String methodsString = "";
+            for (int i = folderInfo.Coders.size() - 1; i >= 0; i--) {
+                CoderInfo coderInfo = folderInfo.Coders.get(i);
+                if (methodsString != "")
+                    methodsString += ' ';
+                
+                // MethodInfo methodInfo;
+                
+                boolean methodIsKnown;
+                
+                for (int j = 0; j < coderInfo.AltCoders.size(); j++) {
+                    if (j > 0)
+                        methodsString += "|";
+                    AltCoderInfo altCoderInfo = coderInfo.AltCoders.get(j);
+                    
+                    String methodName = "";
+                    
+                    methodIsKnown = true;
+                    
+                    if (altCoderInfo.MethodID.equals(MethodID.k_Copy))
+                        methodName = "Copy";
+                    else if (altCoderInfo.MethodID.equals(MethodID.k_LZMA))
+                        methodName = "LZMA";
+                    else if (altCoderInfo.MethodID.equals(MethodID.k_BCJ))
+                        methodName = "BCJ";
+                    else if (altCoderInfo.MethodID.equals(MethodID.k_BCJ2))
+                        methodName = "BCJ2";
+                    else if (altCoderInfo.MethodID.equals(MethodID.k_PPMD))
+                        methodName = "PPMD";
+                    else if (altCoderInfo.MethodID.equals(MethodID.k_Deflate))
+                        methodName = "Deflate";
+                    else if (altCoderInfo.MethodID.equals(MethodID.k_Deflate64))
+                        methodName = "Deflate64";
+                    else if (altCoderInfo.MethodID.equals(MethodID.k_BZip2))
+                        methodName = "BZip2";
+                    else if (altCoderInfo.MethodID.equals(MethodID.k_7zAES))
+                        methodName = "7zAES";
+                    else
+                        methodIsKnown = false;
+                    
+                    if (methodIsKnown) {
+                        methodsString += methodName;
+                        
+                        if (altCoderInfo.MethodID.equals(MethodID.k_LZMA)) {
+                            if (altCoderInfo.Properties.GetCapacity() >= 5) {
+                                methodsString += ":";
+                                int dicSize = GetUInt32FromMemLE(altCoderInfo.Properties.data(),1);
+                                methodsString += GetStringForSizeValue(dicSize);
+                            }
+                        }
+                        /* else if (altCoderInfo.MethodID == k_PPMD) {
+                            if (altCoderInfo.Properties.GetCapacity() >= 5) {
+                                Byte order = *(const Byte *)altCoderInfo.Properties;
+                                methodsString += ":o";
+                                methodsString += ConvertUInt32ToString(order);
+                                methodsString += ":mem";
+                                UInt32 dicSize = GetUInt32FromMemLE(
+                                        ((const Byte *)altCoderInfo.Properties + 1));
+                                methodsString += GetStringForSizeValue(dicSize);
+                            }
+                        } else if (altCoderInfo.MethodID == k_AES) {
+                            if (altCoderInfo.Properties.GetCapacity() >= 1) {
+                                methodsString += ":";
+                                const Byte *data = (const Byte *)altCoderInfo.Properties;
+                                Byte firstByte = *data++;
+                                UInt32 numCyclesPower = firstByte & 0x3F;
+                                methodsString += ConvertUInt32ToString(numCyclesPower);
+                            }
+                        } else {
+                            if (altCoderInfo.Properties.GetCapacity() > 0) {
+                                methodsString += ":[";
+                                for (size_t bi = 0; bi < altCoderInfo.Properties.GetCapacity(); bi++) {
+                                    if (bi > 5 && bi + 1 < altCoderInfo.Properties.GetCapacity()) {
+                                        methodsString += "..";
+                                        break;
+                                    } else
+                                        methodsString += GetHex2(altCoderInfo.Properties[bi]);
+                                }
+                                methodsString += "]";
+                            }
+                        }
+                         */
+                    } else {
+                        // TBD methodsString += altCoderInfo.MethodID.ConvertToString();
+                    }
+                }
+            }
+            ret = methodsString;
+        }
+        
+        return ret;
+    }
+    
+    public SevenZipEntry getEntry(int index) {
+        org.j7zip.SevenZip.Archive.SevenZip.FileItem item = _database.Files.get(index);
+        int index2 = index;
+        
+        long crc = -1;
+        if (item.IsFileCRCDefined) {
+            crc = item.FileCRC & 0xFFFFFFFFL;
+        }
+        
+        long position = -1;
+        if (item.IsStartPosDefined)
+            position = item.StartPos;
+        
+        SevenZipEntry entry = new SevenZipEntry(
+                item.name,
+                getPackSize(index2),
+                item.UnPackSize,
+                crc,
+                item.LastWriteTime,
+                position,
+                item.IsDirectory,
+                item.Attributes,
+                getMethods(index2)
+                );
+        
+        return entry;
+    }
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Header.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Header.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/Header.java	(revision 29679)
@@ -0,0 +1,44 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+class Header
+{
+    public static final int kSignatureSize = 6;
+    public static byte [] kSignature= {'7', 'z', (byte)0xBC, (byte)0xAF, 0x27, 0x1C};
+    public static byte kMajorVersion = 0;
+    
+    public class NID
+    {
+        public static final int kEnd = 0;      
+        public static final int kHeader = 1;
+        public static final int kArchiveProperties = 2;
+        public static final int kAdditionalStreamsInfo = 3;
+        public static final int kMainStreamsInfo = 4;
+        public static final int kFilesInfo = 5;
+    
+        public static final int kPackInfo = 6;
+        public static final int kUnPackInfo = 7;
+        public static final int kSubStreamsInfo = 8;
+
+        public static final int kSize = 9;
+        public static final int kCRC = 10;
+        
+        public static final int kFolder = 11;
+        public static final int kCodersUnPackSize = 12;
+        public static final int kNumUnPackStream = 13;
+ 
+        public static final int kEmptyStream = 14;
+        public static final int kEmptyFile = 15;
+        public static final int kAnti = 16;
+
+        public static final int kName = 17;
+        public static final int kCreationTime = 18;
+        public static final int kLastAccessTime = 19;
+        public static final int kLastWriteTime = 20;
+        public static final int kWinAttributes = 21;
+        public static final int kComment = 22;
+
+        public static final int kEncodedHeader = 23;
+
+        public static final int kStartPos = 24;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/InArchive.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/InArchive.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/InArchive.java	(revision 29679)
@@ -0,0 +1,1069 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+
+import java.io.IOException;
+
+import org.j7zip.Common.BoolVector;
+import org.j7zip.Common.ByteBuffer;
+import org.j7zip.Common.CRC;
+import org.j7zip.Common.IntVector;
+import org.j7zip.Common.LongVector;
+import org.j7zip.Common.ObjectVector;
+import org.j7zip.SevenZip.HRESULT;
+import org.j7zip.SevenZip.IInStream;
+import org.j7zip.SevenZip.Archive.Common.BindPair;
+import org.j7zip.SevenZip.Common.StreamUtils;
+
+
+class InArchive extends Header {
+    
+    // CNum
+    static public final int kNumMax = 0x7FFFFFFF;
+    static public final int kNumNoIndex = 0xFFFFFFFF;
+    
+    
+    IInStream _stream; // CMyComPtr<IInStream> _stream;
+    
+    ObjectVector<InByte2> _inByteVector;
+    InByte2 _inByteBack;
+    
+    long _arhiveBeginStreamPosition;
+    long _position;
+    
+    public InArchive() {
+        _inByteVector = new ObjectVector<InByte2>();
+        _inByteBack = new InByte2();
+    }
+    
+    public void AddByteStream(byte [] buffer, int size) {
+        _inByteVector.add(new InByte2());
+        _inByteBack = _inByteVector.Back();
+        _inByteBack.Init(buffer, size);
+    }
+    
+    void DeleteByteStream() {
+        _inByteVector.DeleteBack();
+        if (!_inByteVector.isEmpty())
+            _inByteBack = _inByteVector.Back();
+    }
+    
+    static boolean TestSignatureCandidate(byte [] testBytes, int off) {
+        for (int i = 0; i < kSignatureSize; i++) {
+            // System.out.println(" " + i + ":" + testBytes[i] + " " + kSignature[i]);
+            if (testBytes[i + off] != kSignature[i])
+                return false;
+        }
+        return true;
+    }
+    int ReadDirect(IInStream stream, // IInStream *stream,
+            byte [] data, // void *data,
+            int off,
+            int size // UInt32 size,
+            ) throws IOException {
+        int realProcessedSize = StreamUtils.ReadStream(stream, data, off, size);
+        if (realProcessedSize != -1) _position += realProcessedSize;
+        return realProcessedSize;
+    }
+    int ReadDirect(byte [] data, int size) throws IOException {
+        return ReadDirect(_stream, data, 0, size);
+    }
+    
+    int SafeReadDirectUInt32() throws IOException {
+        int val = 0;
+        byte [] b = new byte[4];
+        
+        int realProcessedSize = ReadDirect(b, 4);
+        if (realProcessedSize != 4)
+            throw new IOException("Unexpected End Of Archive"); // throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive);
+        
+        for (int i = 0; i < 4; i++) {
+            val |= ((b[i] & 0xff) << (8 * i));
+        }
+        return val;
+    }
+    
+    int ReadUInt32() throws IOException {
+        int value = 0;
+        for (int i = 0; i < 4; i++) {
+            int b = ReadByte();
+            value |= ((b) << (8 * i));
+        }
+        return value;
+    }
+    
+    long ReadUInt64() throws IOException {
+        long value = 0;
+        for (int i = 0; i < 8; i++) {
+            int b = ReadByte();
+            value |= (((long)b) << (8 * i));
+        }
+        return value;
+    }
+    
+    int ReadBytes(byte data[], int size)  throws IOException {
+        if (!_inByteBack.ReadBytes(data, size))
+            return HRESULT.E_FAIL;
+        return HRESULT.S_OK;
+    }
+    
+    int ReadByte()  throws IOException {
+        return _inByteBack.ReadByte();
+    }
+    
+    long SafeReadDirectUInt64() throws IOException {
+        long val = 0;
+        byte [] b = new byte[8];
+        
+        int realProcessedSize = ReadDirect(b, 8);
+        if (realProcessedSize != 8)
+            throw new IOException("Unexpected End Of Archive"); // throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive);
+        
+        for (int i = 0; i < 8; i++) {
+            val |= ((long)(b[i] & 0xFF) << (8 * i));
+        }
+        return val;
+    }
+    
+    char ReadWideCharLE()   throws IOException {
+        int b1 = _inByteBack.ReadByte();
+        int b2 = _inByteBack.ReadByte();
+        char c = (char)(((char)(b2) << 8) + b1);
+        return c;
+    }
+    
+    long ReadNumber()  throws IOException {
+        int firstByte = ReadByte();
+        
+        int mask = 0x80;
+        long value = 0;
+        for (int i = 0; i < 8; i++) {
+            if ((firstByte & mask) == 0) {
+                long highPart = firstByte & (mask - 1);
+                value += (highPart << (i * 8));
+                return value;
+            }
+            int b = ReadByte();
+            if (b < 0)
+                throw new IOException("ReadNumber - Can't read stream");
+            
+            value |= (((long)b) << (8 * i));
+            mask >>= 1;
+        }
+        return value;
+    }
+    
+    int ReadNum()  throws IOException { // CNum
+        long value64 = ReadNumber();
+        if (value64 > InArchive.kNumMax)
+            throw new IOException("ReadNum - value > CNum.kNumMax"); // return E_FAIL;
+        
+        return (int)value64;
+    }
+    
+    long ReadID()   throws IOException {
+        return ReadNumber();
+    }
+    
+    int FindAndReadSignature(
+            IInStream stream, // IInStream *stream,
+            long searchHeaderSizeLimit // const UInt64 *searchHeaderSizeLimit
+            ) throws IOException {
+        _position = _arhiveBeginStreamPosition;
+        
+        stream.Seek(_arhiveBeginStreamPosition,IInStream.STREAM_SEEK_SET);
+        
+        byte [] signature = new byte[kSignatureSize];
+        
+        int processedSize = ReadDirect(stream, signature, 0, kSignatureSize);
+        if(processedSize != kSignatureSize)
+            return HRESULT.S_FALSE;
+        
+        if (TestSignatureCandidate(signature,0))
+            return HRESULT.S_OK;
+        
+        // SFX support
+        ByteBuffer byteBuffer = new ByteBuffer();
+        final int kBufferSize = (1 << 16);
+        byteBuffer.SetCapacity(kBufferSize);
+        byte [] buffer = byteBuffer.data();
+        int numPrevBytes = kSignatureSize - 1;
+        
+        System.arraycopy(signature,1,buffer,0,numPrevBytes);
+        
+        long curTestPos = _arhiveBeginStreamPosition + 1;
+        for (;;) {
+            if (searchHeaderSizeLimit != -1)
+                if (curTestPos - _arhiveBeginStreamPosition > searchHeaderSizeLimit)
+                    break;
+            int numReadBytes = kBufferSize - numPrevBytes;
+            
+            // RINOK(ReadDirect(stream, buffer + numPrevBytes, numReadBytes, &processedSize));
+            processedSize = ReadDirect(stream, buffer,numPrevBytes, numReadBytes);
+            if (processedSize == -1) return HRESULT.S_FALSE;
+            
+            int numBytesInBuffer = numPrevBytes + processedSize;
+            if (numBytesInBuffer < kSignatureSize)
+                break;
+            int numTests = numBytesInBuffer - kSignatureSize + 1;
+            for(int pos = 0; pos < numTests; pos++, curTestPos++) {
+                if (TestSignatureCandidate(buffer , pos)) {
+                    _arhiveBeginStreamPosition = curTestPos;
+                    _position = curTestPos + kSignatureSize;
+                    stream.Seek(_position, IInStream.STREAM_SEEK_SET);
+                    return HRESULT.S_OK;
+                }
+            }
+            numPrevBytes = numBytesInBuffer - numTests;
+            System.arraycopy(buffer,numTests,buffer,0,numPrevBytes);
+        }
+        
+        return HRESULT.S_FALSE;
+    }
+    
+    int SkeepData(long size)  throws IOException {
+        for (long i = 0; i < size; i++) {
+            int temp = ReadByte();
+        }
+        return HRESULT.S_OK;
+    }
+    
+    int SkeepData()  throws IOException {
+        long size = ReadNumber();
+        return SkeepData(size);
+    }
+    
+    
+    int ReadArchiveProperties(InArchiveInfo archiveInfo)  throws IOException {
+        for (;;) {
+            long type = ReadID();
+            if (type == NID.kEnd)
+                break;
+            SkeepData();
+        }
+        return HRESULT.S_OK;
+    }
+    
+    int GetNextFolderItem(Folder folder)  throws IOException {
+        int numCoders = ReadNum();
+        
+        folder.Coders.clear();
+        folder.Coders.Reserve(numCoders);
+        int numInStreams = 0;
+        int numOutStreams = 0;
+        int i;
+        for (i = 0; i < numCoders; i++) {
+            folder.Coders.add(new CoderInfo());
+            CoderInfo coder = folder.Coders.Back();
+            
+            for (;;) {
+                coder.AltCoders.add(new AltCoderInfo());
+                AltCoderInfo altCoder = coder.AltCoders.Back();
+                int mainByte = ReadByte();
+                altCoder.MethodID.IDSize = (byte)(mainByte & 0xF);
+                int ret = ReadBytes(altCoder.MethodID.ID, altCoder.MethodID.IDSize);
+                if (ret != HRESULT.S_OK) return ret;
+                if ((mainByte & 0x10) != 0) {
+                    coder.NumInStreams = ReadNum();
+                    coder.NumOutStreams = ReadNum();
+                } else {
+                    coder.NumInStreams = 1;
+                    coder.NumOutStreams = 1;
+                }
+                if ((mainByte & 0x20) != 0) {
+                    int propertiesSize = ReadNum();
+                    altCoder.Properties.SetCapacity(propertiesSize);
+                    // RINOK(ReadBytes((Byte *)altCoder.Properties, (size_t)propertiesSize));
+                    ret = ReadBytes(altCoder.Properties.data(), propertiesSize);
+                }
+                if ((mainByte & 0x80) == 0)
+                    break;
+            }
+            numInStreams += coder.NumInStreams;
+            numOutStreams += coder.NumOutStreams;
+        }
+        
+        // RINOK(ReadNumber(numBindPairs));
+        int numBindPairs = numOutStreams - 1;
+        folder.BindPairs.clear();
+        folder.BindPairs.Reserve(numBindPairs);
+        for (i = 0; i < numBindPairs; i++) {
+            BindPair bindPair = new BindPair();
+            bindPair.InIndex = ReadNum();
+            bindPair.OutIndex = ReadNum();
+            folder.BindPairs.add(bindPair);
+        }
+        
+        int numPackedStreams = numInStreams - numBindPairs;
+        folder.PackStreams.Reserve(numPackedStreams);
+        if (numPackedStreams == 1) {
+            for (int j = 0; j < numInStreams; j++)
+                if (folder.FindBindPairForInStream(j) < 0) {
+                folder.PackStreams.add(j);
+                break;
+                }
+        } else
+            for(i = 0; i < numPackedStreams; i++) {
+            int packStreamInfo = ReadNum();
+            folder.PackStreams.add(packStreamInfo);
+            }
+        
+        return HRESULT.S_OK;
+    }
+    
+    int WaitAttribute(long attribute)  throws IOException {
+        for (;;) {
+            long type = ReadID();
+            if (type == attribute)
+                return HRESULT.S_OK;
+            if (type == NID.kEnd)
+                return HRESULT.S_FALSE;
+            int ret = SkeepData();
+            if (ret != HRESULT.S_OK) return ret;
+        }
+    }
+    
+    int Open(
+            IInStream stream,  // IInStream *stream
+            long searchHeaderSizeLimit // const UInt64 *searchHeaderSizeLimit
+            ) throws IOException {
+        Close();
+        
+        _arhiveBeginStreamPosition = stream.Seek(0, IInStream.STREAM_SEEK_CUR);
+        _position = _arhiveBeginStreamPosition;
+        
+        int ret = FindAndReadSignature(stream, searchHeaderSizeLimit);
+        if (ret != HRESULT.S_OK) return ret;
+        
+        _stream = stream;
+        
+        return HRESULT.S_OK;
+    }
+    
+    void Close()  throws IOException {
+        if (_stream != null) _stream.close(); // _stream.Release();
+        _stream = null;
+    }
+    
+    int ReadStreamsInfo(
+            ObjectVector<ByteBuffer> dataVector,
+            long [] dataOffset,
+            LongVector packSizes,
+            BoolVector packCRCsDefined,
+            IntVector packCRCs,
+            ObjectVector<Folder> folders,
+            IntVector numUnPackStreamsInFolders,
+            LongVector unPackSizes,
+            BoolVector digestsDefined,
+            IntVector digests)  throws IOException {
+        
+        for (;;) {
+            long type = ReadID();
+            switch((int)type) {
+                case NID.kEnd:
+                    return HRESULT.S_OK;
+                case NID.kPackInfo:
+                {
+                    int result = ReadPackInfo(dataOffset, packSizes,
+                            packCRCsDefined, packCRCs);
+                    if (result != HRESULT.S_OK) return result;
+                    break;
+                }
+                case NID.kUnPackInfo:
+                {
+                    int result = ReadUnPackInfo(dataVector, folders);
+                    if (result != HRESULT.S_OK) return result;
+                    break;
+                }
+                case NID.kSubStreamsInfo:
+                {
+                    int result = ReadSubStreamsInfo(folders, numUnPackStreamsInFolders,
+                            unPackSizes, digestsDefined, digests);
+                    if (result != HRESULT.S_OK) return result;
+                    break;
+                }
+            }
+        }
+    }
+    
+    int ReadFileNames(ObjectVector<FileItem> files)  throws IOException {
+        for(int i = 0; i < files.size(); i++) {
+            String name = new String();
+            for (;;) {
+                char c = ReadWideCharLE();
+                if (c == '\0')
+                    break;
+                name += c;
+            }
+            files.get(i).name = name;
+        }
+        return HRESULT.S_OK;
+    }
+    
+    int ReadBoolVector(int numItems, BoolVector v)  throws IOException {
+        v.clear();
+        v.Reserve(numItems);
+        int b = 0;
+        int mask = 0;
+        for(int i = 0; i < numItems; i++) {
+            if (mask == 0) {
+                b = ReadByte();
+                mask = 0x80;
+            }
+            v.add((b & mask) != 0);
+            mask >>= 1;
+        }
+        return HRESULT.S_OK;
+    }
+    
+    int ReadBoolVector2(int numItems, BoolVector v)  throws IOException { // CBoolVector
+        int allAreDefined = ReadByte();
+        if (allAreDefined == 0)
+            return ReadBoolVector(numItems, v);
+        v.clear();
+        v.Reserve(numItems);
+        for (int i = 0; i < numItems; i++)
+            v.add(true);
+        return HRESULT.S_OK;
+    }
+    
+    int ReadHashDigests(int numItems,
+            BoolVector digestsDefined,
+            IntVector digests)  throws IOException {
+        int ret = ReadBoolVector2(numItems, digestsDefined);
+        if (ret != HRESULT.S_OK) return ret;
+        
+        digests.clear();
+        digests.Reserve(numItems);
+        for(int i = 0; i < numItems; i++) {
+            int crc = 0;
+            if (digestsDefined.get(i))
+                crc = ReadUInt32();
+            digests.add(crc);
+        }
+        return HRESULT.S_OK;
+    }
+    
+    int ReadPackInfo(
+            long []  dataOffset, // UInt64 &dataOffset,
+            LongVector packSizes, // CRecordVector<UInt64> &packSizes,
+            BoolVector packCRCsDefined, // CRecordVector<bool> &packCRCsDefined,
+            IntVector packCRCs) // CRecordVector<UInt32> &packCRCs)
+            throws IOException {
+        dataOffset[0] = ReadNumber();
+        int numPackStreams = ReadNum();
+        
+        int ret = WaitAttribute(NID.kSize);
+        if (ret != HRESULT.S_OK) return ret;
+        
+        packSizes.clear();
+        packSizes.Reserve(numPackStreams);
+        for(int i = 0; i < numPackStreams; i++) // CNum i
+        {
+            long size = ReadNumber();
+            packSizes.add(size);
+        }
+        
+        long type;
+        for (;;) {
+            type = ReadID();
+            if (type == NID.kEnd)
+                break;
+            if (type == NID.kCRC) {
+                ret = ReadHashDigests(numPackStreams, packCRCsDefined, packCRCs);
+                if (ret != HRESULT.S_OK) return ret;
+                continue;
+            }
+            ret = SkeepData();
+            if (ret != HRESULT.S_OK) return ret;
+        }
+        if (packCRCsDefined.isEmpty()) {
+            packCRCsDefined.Reserve(numPackStreams);
+            packCRCsDefined.clear();
+            packCRCs.Reserve(numPackStreams);
+            packCRCs.clear();
+            for(int i = 0; i < numPackStreams; i++) {
+                packCRCsDefined.add(false);
+                packCRCs.add(0);
+            }
+        }
+        return HRESULT.S_OK;
+    }
+    
+    int ReadUnPackInfo(
+            ObjectVector<ByteBuffer> dataVector,
+            ObjectVector<Folder> folders)  throws IOException {
+        int ret = WaitAttribute(NID.kFolder);
+        if (ret != HRESULT.S_OK) return ret;
+        
+        int numFolders = ReadNum();
+        
+        {
+            StreamSwitch streamSwitch = new StreamSwitch();
+            ret = streamSwitch.Set(this, dataVector);
+            if (ret != HRESULT.S_OK) return ret;
+            folders.clear();
+            folders.Reserve(numFolders);
+            for(int i = 0; i < numFolders; i++) {
+                folders.add(new Folder());
+                ret = GetNextFolderItem(folders.Back());
+                if (ret != HRESULT.S_OK) {
+                    streamSwitch.close();
+                    return ret;
+                }
+            }
+            streamSwitch.close();
+        }
+        
+        ret = WaitAttribute(NID.kCodersUnPackSize);
+        if (ret != HRESULT.S_OK) return ret;
+        
+        for(int i = 0; i < numFolders; i++) {
+            Folder folder = folders.get(i);
+            int numOutStreams = folder.GetNumOutStreams();
+            folder.UnPackSizes.Reserve(numOutStreams);
+            for(int j = 0; j < numOutStreams; j++) {
+                long unPackSize = ReadNumber();
+                folder.UnPackSizes.add(unPackSize);
+            }
+        }
+        
+        for (;;) {
+            long type = ReadID();
+            if (type == NID.kEnd)
+                return HRESULT.S_OK;
+            if (type == NID.kCRC) {
+                BoolVector crcsDefined = new BoolVector();
+                IntVector crcs = new IntVector();
+                ret = ReadHashDigests(numFolders, crcsDefined, crcs);
+                if (ret != HRESULT.S_OK) return ret;
+                for(int i = 0; i < numFolders; i++) {
+                    Folder folder = folders.get(i);
+                    folder.UnPackCRCDefined = crcsDefined.get(i);
+                    folder.UnPackCRC = crcs.get(i);
+                }
+                continue;
+            }
+            ret = SkeepData();
+            if (ret != HRESULT.S_OK) return ret;
+        }
+    }
+    
+    int ReadSubStreamsInfo(
+            ObjectVector<Folder> folders,
+            IntVector numUnPackStreamsInFolders,
+            LongVector unPackSizes,
+            BoolVector digestsDefined,
+            IntVector digests)  throws IOException {
+        numUnPackStreamsInFolders.clear();
+        numUnPackStreamsInFolders.Reserve(folders.size());
+        long type;
+        for (;;) {
+            type = ReadID();
+            if (type == NID.kNumUnPackStream) {
+                for(int i = 0; i < folders.size(); i++) {
+                    int value = ReadNum();
+                    numUnPackStreamsInFolders.add(value);
+                }
+                continue;
+            }
+            if (type == NID.kCRC || type == NID.kSize)
+                break;
+            if (type == NID.kEnd)
+                break;
+            int ret = SkeepData();
+            if (ret != HRESULT.S_OK) return ret;
+        }
+        
+        if (numUnPackStreamsInFolders.isEmpty())
+            for(int i = 0; i < folders.size(); i++)
+                numUnPackStreamsInFolders.add(1);
+        
+        for(int i = 0; i < numUnPackStreamsInFolders.size(); i++) {
+            // v3.13 incorrectly worked with empty folders
+            // v4.07: we check that folder is empty
+            int numSubstreams = numUnPackStreamsInFolders.get(i);
+            if (numSubstreams == 0)
+                continue;
+            long sum = 0;
+            for (int j = 1; j < numSubstreams; j++) {
+                long size;
+                if (type == NID.kSize) {
+                    size = ReadNumber();
+                    unPackSizes.add(size);
+                    sum += size;
+                }
+            }
+            unPackSizes.add(folders.get(i).GetUnPackSize() - sum);
+        }
+        if (type == NID.kSize) {
+            type = ReadID();
+        }
+        
+        int numDigests = 0;
+        int numDigestsTotal = 0;
+        for(int i = 0; i < folders.size(); i++) {
+            int numSubstreams = numUnPackStreamsInFolders.get(i);
+            if (numSubstreams != 1 || !folders.get(i).UnPackCRCDefined)
+                numDigests += numSubstreams;
+            numDigestsTotal += numSubstreams;
+        }
+        
+        for (;;) {
+            if (type == NID.kCRC) {
+                BoolVector digestsDefined2 = new BoolVector();
+                IntVector digests2 = new IntVector();
+                int ret = ReadHashDigests(numDigests, digestsDefined2, digests2);
+                if (ret != HRESULT.S_OK) return ret;
+                
+                int digestIndex = 0;
+                for (int i = 0; i < folders.size(); i++) {
+                    int numSubstreams = numUnPackStreamsInFolders.get(i);
+                    Folder folder = folders.get(i);
+                    if (numSubstreams == 1 && folder.UnPackCRCDefined) {
+                        digestsDefined.add(true);
+                        digests.add(folder.UnPackCRC);
+                    } else
+                        for (int j = 0; j < numSubstreams; j++, digestIndex++) {
+                        digestsDefined.add(digestsDefined2.get(digestIndex));
+                        digests.add(digests2.get(digestIndex));
+                        }
+                }
+            } else if (type == NID.kEnd) {
+                if (digestsDefined.isEmpty()) {
+                    digestsDefined.clear();
+                    digests.clear();
+                    for (int i = 0; i < numDigestsTotal; i++) {
+                        digestsDefined.add(false);
+                        digests.add(0);
+                    }
+                }
+                return HRESULT.S_OK;
+            } else {
+                int ret = SkeepData();
+                if (ret != HRESULT.S_OK) return ret;
+            }
+            type = ReadID();
+        }
+    }
+    
+    static final long SECS_BETWEEN_EPOCHS = 11644473600L;
+    static final long SECS_TO_100NS = 10000000L; /* 10^7 */
+    
+    static long FileTimeToLong(int dwHighDateTime, int dwLowDateTime) {
+        // The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1
+        long tm = dwHighDateTime;
+        tm <<=32;
+        tm |= (dwLowDateTime & 0xFFFFFFFFL);
+        return (tm -  (SECS_BETWEEN_EPOCHS * SECS_TO_100NS)) / (10000L); /* now convert to milliseconds */
+    }
+    
+    int ReadTime(ObjectVector<ByteBuffer> dataVector,
+            ObjectVector<FileItem> files, long type)  throws IOException {
+        BoolVector boolVector = new BoolVector();
+        int ret = ReadBoolVector2(files.size(), boolVector);
+        if (ret != HRESULT.S_OK) return ret;
+        
+        StreamSwitch streamSwitch = new StreamSwitch();
+        ret = streamSwitch.Set(this, dataVector);
+        if (ret != HRESULT.S_OK) {
+            streamSwitch.close();
+            return ret;
+        }
+        
+        for(int i = 0; i < files.size(); i++) {
+            FileItem file = files.get(i);
+            int low = 0;
+            int high = 0;
+            boolean defined = boolVector.get(i);
+            if (defined) {
+                low = ReadUInt32();
+                high = ReadUInt32();
+            }
+            switch((int)type) {
+                case NID.kCreationTime:
+                    // file.IsCreationTimeDefined = defined;
+                    if (defined)
+                        file.CreationTime = FileTimeToLong(high,low);
+                    break;
+                case NID.kLastWriteTime:
+                    // file.IsLastWriteTimeDefined = defined;
+                    if (defined)
+                        file.LastWriteTime = FileTimeToLong(high,low);
+                    break;
+                case NID.kLastAccessTime:
+                    // file.IsLastAccessTimeDefined = defined;
+                    if (defined)
+                        file.LastAccessTime = FileTimeToLong(high,low);
+                    break;
+            }
+        }
+        streamSwitch.close();
+        return HRESULT.S_OK;
+    }
+    
+    int ReadAndDecodePackedStreams(long baseOffset,
+            long [] dataOffset,
+            ObjectVector<ByteBuffer> dataVector // CObjectVector<CByteBuffer> &dataVector
+            ) throws IOException {
+        LongVector packSizes = new LongVector(); // CRecordVector<UInt64> packSizes;
+        BoolVector packCRCsDefined = new BoolVector(); // CRecordVector<bool> packCRCsDefined;
+        IntVector packCRCs = new IntVector(); // CRecordVector<UInt32> packCRCs;
+        
+        ObjectVector<Folder> folders = new ObjectVector<Folder>();
+        
+        IntVector numUnPackStreamsInFolders = new IntVector();
+        LongVector unPackSizes = new LongVector();
+        BoolVector digestsDefined = new BoolVector();
+        IntVector digests = new IntVector();
+        
+        int ret = ReadStreamsInfo(null,
+                dataOffset,
+                packSizes,
+                packCRCsDefined,
+                packCRCs,
+                folders,
+                numUnPackStreamsInFolders,
+                unPackSizes,
+                digestsDefined,
+                digests);
+        
+        // database.ArchiveInfo.DataStartPosition2 += database.ArchiveInfo.StartPositionAfterHeader;
+        
+        int packIndex = 0;
+        Decoder decoder = new Decoder(false); // _ST_MODE
+        
+        long dataStartPos = baseOffset + dataOffset[0];
+        for(int i = 0; i < folders.size(); i++) {
+            Folder folder = folders.get(i); // const CFolder &folder = folders[i];
+            dataVector.add(new ByteBuffer());
+            ByteBuffer data = dataVector.Back();
+            long unPackSize = folder.GetUnPackSize();
+            if (unPackSize > InArchive.kNumMax)
+                return HRESULT.E_FAIL;
+            if (unPackSize > 0xFFFFFFFFL)
+                return HRESULT.E_FAIL;
+            data.SetCapacity((int)unPackSize);
+            
+            org.j7zip.SevenZip.Common.SequentialOutStreamImp2 outStreamSpec = new org.j7zip.SevenZip.Common.SequentialOutStreamImp2();
+            java.io.OutputStream outStream = outStreamSpec;
+            outStreamSpec.Init(data.data(), (int)unPackSize);
+            
+            int result = decoder.Decode(_stream, dataStartPos,
+                    packSizes,packIndex,  // &packSizes[packIndex]
+                    folder, outStream, null
+                    // _ST_MODE , false, 1
+                    );
+            if (result != HRESULT.S_OK) return result;
+            
+            if (folder.UnPackCRCDefined)
+                if (!CRC.VerifyDigest(folder.UnPackCRC, data.data(), (int)unPackSize))
+                    throw new IOException("Incorrect Header"); // CInArchiveException(CInArchiveException::kIncorrectHeader);
+            for (int j = 0; j < folder.PackStreams.size(); j++)
+                dataStartPos += packSizes.get(packIndex++);
+        }
+        return HRESULT.S_OK;
+    }
+    
+    int ReadDatabase(ArchiveDatabaseEx database) throws IOException {
+        database.Clear();
+        database.ArchiveInfo.StartPosition = _arhiveBeginStreamPosition;
+        
+        byte [] btmp = new byte[2];
+        int realProcessedSize = ReadDirect(btmp, 2);
+        if (realProcessedSize != 2)
+            throw new IOException("Unexpected End Of Archive"); // throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive);
+        
+        database.ArchiveInfo.ArchiveVersion_Major = btmp[0];
+        database.ArchiveInfo.ArchiveVersion_Minor = btmp[1];
+        
+        if (database.ArchiveInfo.ArchiveVersion_Major != kMajorVersion)
+            throw new IOException("Unsupported Version");
+        
+        CRC crc = new CRC();
+        int crcFromArchive = SafeReadDirectUInt32();
+        long nextHeaderOffset = SafeReadDirectUInt64();
+        long nextHeaderSize = SafeReadDirectUInt64();
+        int nextHeaderCRC = SafeReadDirectUInt32();
+        
+/*
+  #ifdef FORMAT_7Z_RECOVERY
+  ...
+  #endif
+ */
+        
+        crc.UpdateUInt64(nextHeaderOffset);
+        crc.UpdateUInt64(nextHeaderSize);
+        crc.UpdateUInt32(nextHeaderCRC);
+        
+        database.ArchiveInfo.StartPositionAfterHeader = _position;
+        
+        if (crc.GetDigest() != crcFromArchive)
+            throw new IOException("Incorrect Header"); // CInArchiveException(CInArchiveException::kIncorrectHeader);
+        
+        if (nextHeaderSize == 0)
+            return HRESULT.S_OK;
+        
+        if (nextHeaderSize >= 0xFFFFFFFFL)
+            return HRESULT.E_FAIL;
+        
+        _position = _stream.Seek(nextHeaderOffset,IInStream.STREAM_SEEK_CUR);
+        
+        ByteBuffer buffer2 = new ByteBuffer();
+        buffer2.SetCapacity((int)nextHeaderSize);
+        
+        // SafeReadDirect(buffer2.data(), (int)nextHeaderSize);
+        realProcessedSize = ReadDirect(buffer2.data(), (int)nextHeaderSize);
+        if (realProcessedSize != (int)nextHeaderSize)
+            throw new IOException("Unexpected End Of Archive"); // throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive);
+        
+        if (!CRC.VerifyDigest(nextHeaderCRC, buffer2.data(), (int)nextHeaderSize))
+            throw new IOException("Incorrect Header"); // CInArchiveException(CInArchiveException::kIncorrectHeader);
+        
+        StreamSwitch streamSwitch = new StreamSwitch();
+        streamSwitch.Set(this, buffer2);
+        
+        ObjectVector<ByteBuffer> dataVector = new ObjectVector<ByteBuffer>(); // CObjectVector<CByteBuffer> dataVector;
+        
+        for (;;) {
+            long type = ReadID();
+            if (type == NID.kHeader)
+                break;
+            if (type != NID.kEncodedHeader)
+                throw new IOException("Incorrect Header"); // CInArchiveException(CInArchiveException::kIncorrectHeader);
+            
+            long [] ltmp = new long[1];
+            ltmp[0] = database.ArchiveInfo.DataStartPosition2;
+            int result = ReadAndDecodePackedStreams(
+                    database.ArchiveInfo.StartPositionAfterHeader,
+                    ltmp, // database.ArchiveInfo.DataStartPosition2,
+                    dataVector);
+            if (result != HRESULT.S_OK) return result;
+            
+            database.ArchiveInfo.DataStartPosition2 = ltmp[0];
+            
+            if (dataVector.size() == 0)
+                return HRESULT.S_OK;
+            if (dataVector.size() > 1)
+                throw new IOException("Incorrect Header"); // CInArchiveException(CInArchiveException::kIncorrectHeader);
+            streamSwitch.Remove();
+            streamSwitch.Set(this, dataVector.get(0)); // dataVector.Front()
+        }
+        
+        streamSwitch.close();
+        return ReadHeader(database);
+    }
+    
+    int ReadHeader(ArchiveDatabaseEx database)  throws IOException {
+        long type = ReadID();
+        
+        if (type == NID.kArchiveProperties) {
+            int ret = ReadArchiveProperties(database.ArchiveInfo);
+            if (ret != HRESULT.S_OK) return ret;
+            type = ReadID();
+        }
+        
+        ObjectVector<ByteBuffer> dataVector = new ObjectVector<ByteBuffer>();
+        
+        if (type == NID.kAdditionalStreamsInfo) {
+            long [] ltmp = new long[1];
+            ltmp[0] = database.ArchiveInfo.DataStartPosition2;
+            int result = ReadAndDecodePackedStreams(
+                    database.ArchiveInfo.StartPositionAfterHeader,
+                    ltmp, // database.ArchiveInfo.DataStartPosition2,
+                    dataVector);
+            if (result != HRESULT.S_OK) return result;
+            
+            database.ArchiveInfo.DataStartPosition2 = ltmp[0];
+            
+            database.ArchiveInfo.DataStartPosition2 += database.ArchiveInfo.StartPositionAfterHeader;
+            type = ReadID();
+        }
+        
+        LongVector unPackSizes = new LongVector();
+        BoolVector digestsDefined = new BoolVector();
+        IntVector digests = new IntVector();
+        
+        if (type == NID.kMainStreamsInfo) {
+            long [] ltmp = new long[1];
+            ltmp[0] = database.ArchiveInfo.DataStartPosition;
+            int result = ReadStreamsInfo(dataVector,
+                    ltmp, // database.ArchiveInfo.DataStartPosition,
+                    database.PackSizes,
+                    database.PackCRCsDefined,
+                    database.PackCRCs,
+                    database.Folders,
+                    database.NumUnPackStreamsVector,
+                    unPackSizes,
+                    digestsDefined,
+                    digests);
+            if (result != HRESULT.S_OK) return result;
+            database.ArchiveInfo.DataStartPosition = ltmp[0];
+            database.ArchiveInfo.DataStartPosition += database.ArchiveInfo.StartPositionAfterHeader;
+            type = ReadID();
+        } else {
+            for(int i = 0; i < database.Folders.size(); i++) {
+                database.NumUnPackStreamsVector.add(1);
+                Folder folder = database.Folders.get(i);
+                unPackSizes.add(folder.GetUnPackSize());
+                digestsDefined.add(folder.UnPackCRCDefined);
+                digests.add(folder.UnPackCRC);
+            }
+        }
+        
+        database.Files.clear();
+        
+        if (type == NID.kEnd)
+            return HRESULT.S_OK;
+        if (type != NID.kFilesInfo)
+            throw new IOException("Incorrect Header"); // throw CInArchiveException(CInArchiveException::kIncorrectHeader);
+        
+        int numFiles = ReadNum();
+        database.Files.Reserve(numFiles);
+        for(int i = 0; i < numFiles; i++)
+            database.Files.add(new FileItem());
+        
+        database.ArchiveInfo.FileInfoPopIDs.add(NID.kSize);
+        if (!database.PackSizes.isEmpty())
+            database.ArchiveInfo.FileInfoPopIDs.add(NID.kPackInfo);
+        if (numFiles > 0  && !digests.isEmpty())
+            database.ArchiveInfo.FileInfoPopIDs.add(NID.kCRC);
+        
+        BoolVector emptyStreamVector = new BoolVector();
+        emptyStreamVector.Reserve(numFiles);
+        for(int i = 0; i < numFiles; i++)
+            emptyStreamVector.add(false);
+        BoolVector emptyFileVector = new BoolVector();
+        BoolVector antiFileVector = new BoolVector();
+        int numEmptyStreams = 0;
+        
+        // int sizePrev = -1;
+        // int posPrev = 0;
+        
+        for (;;) {
+            type = ReadID();
+            if (type == NID.kEnd)
+                break;
+            long size = ReadNumber();
+            
+            // sizePrev = size;
+            // posPrev = _inByteBack->GetProcessedSize();
+            
+            database.ArchiveInfo.FileInfoPopIDs.add(type);
+            switch((int)type) {
+                case NID.kName:
+                {
+                    StreamSwitch streamSwitch = new StreamSwitch();
+                    int result = streamSwitch.Set(this, dataVector);
+                    if (result != HRESULT.S_OK) return result;
+                    result = ReadFileNames(database.Files);
+                    streamSwitch.close();
+                    if (result != HRESULT.S_OK) return result;
+                    break;
+                }
+                case NID.kWinAttributes:
+                {
+                    BoolVector boolVector = new BoolVector();
+                    int result = ReadBoolVector2(database.Files.size(), boolVector);
+                    if (result != HRESULT.S_OK) return result;
+                    
+                    StreamSwitch streamSwitch = new StreamSwitch();
+                    result = streamSwitch.Set(this, dataVector);
+                    if (result != HRESULT.S_OK) return result;
+                    for(int i = 0; i < numFiles; i++) {
+                        FileItem file = database.Files.get(i);
+                        file.AreAttributesDefined = boolVector.get(i);
+                        if (file.AreAttributesDefined) {
+                            file.Attributes = ReadUInt32();
+                        }
+                    }
+                    streamSwitch.close();
+                    break;
+                }
+                case NID.kStartPos:
+                {
+                    BoolVector boolVector = new BoolVector();
+                    int result = ReadBoolVector2(database.Files.size(), boolVector);
+                    if (result != HRESULT.S_OK) return result;
+                    
+                    StreamSwitch streamSwitch = new StreamSwitch();
+                    result = streamSwitch.Set(this, dataVector);
+                    if (result != HRESULT.S_OK) return result;
+                    for(int i = 0; i < numFiles; i++) {
+                        FileItem file = database.Files.get(i);
+                        file.IsStartPosDefined = boolVector.get(i);
+                        if (file.IsStartPosDefined) {
+                            file.StartPos = ReadUInt64();
+                        }
+                    }
+                    streamSwitch.close();
+                    break;
+                }
+                case NID.kEmptyStream:
+                {
+                    int result = ReadBoolVector(numFiles, emptyStreamVector);
+                    if (result != HRESULT.S_OK) return result;
+                    
+                    for (int i = 0; i < emptyStreamVector.size(); i++)
+                        if (emptyStreamVector.get(i))
+                            numEmptyStreams++;
+                    emptyFileVector.Reserve(numEmptyStreams);
+                    antiFileVector.Reserve(numEmptyStreams);
+                    for (int i = 0; i < numEmptyStreams; i++) {
+                        emptyFileVector.add(false);
+                        antiFileVector.add(false);
+                    }
+                    break;
+                }
+                case NID.kEmptyFile:
+                {
+                    int result = ReadBoolVector(numEmptyStreams, emptyFileVector);
+                    if (result != HRESULT.S_OK) return result;
+                    break;
+                }
+                case NID.kAnti:
+                {
+                    int result = ReadBoolVector(numEmptyStreams, antiFileVector);
+                    if (result != HRESULT.S_OK) return result;
+                    break;
+                }
+                case NID.kCreationTime:
+                case NID.kLastWriteTime:
+                case NID.kLastAccessTime:
+                {
+                    int result = ReadTime(dataVector, database.Files, type);
+                    if (result != HRESULT.S_OK) return result;
+                    break;
+                }
+                default:
+                {
+                    database.ArchiveInfo.FileInfoPopIDs.DeleteBack();
+                    int result = SkeepData(size);
+                    if (result != HRESULT.S_OK) return result;
+                }
+            }
+        }
+        
+        int emptyFileIndex = 0;
+        int sizeIndex = 0;
+        for(int i = 0; i < numFiles; i++) {
+            FileItem file = database.Files.get(i);
+            file.HasStream = !emptyStreamVector.get(i);
+            if(file.HasStream) {
+                file.IsDirectory = false;
+                file.IsAnti = false;
+                file.UnPackSize = unPackSizes.get(sizeIndex);
+                file.FileCRC = digests.get(sizeIndex);
+                file.IsFileCRCDefined = digestsDefined.get(sizeIndex);
+                sizeIndex++;
+            } else {
+                file.IsDirectory = !emptyFileVector.get(emptyFileIndex);
+                file.IsAnti = antiFileVector.get(emptyFileIndex);
+                emptyFileIndex++;
+                file.UnPackSize = 0;
+                file.IsFileCRCDefined = false;
+            }
+        }
+        
+        return HRESULT.S_OK;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/InArchiveInfo.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/InArchiveInfo.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/InArchiveInfo.java	(revision 29679)
@@ -0,0 +1,20 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+import org.j7zip.Common.LongVector;
+
+class InArchiveInfo
+{
+    public byte ArchiveVersion_Major;
+    public byte ArchiveVersion_Minor;
+    
+    public long StartPosition;
+    public long StartPositionAfterHeader;
+    public long DataStartPosition;
+    public long DataStartPosition2;    
+    LongVector FileInfoPopIDs = new LongVector();
+    
+    void Clear()
+    {
+        FileInfoPopIDs.clear();
+    }    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/InByte2.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/InByte2.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/InByte2.java	(revision 29679)
@@ -0,0 +1,36 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+import java.io.IOException;
+
+class InByte2 {
+    byte [] _buffer;
+    int _size;
+    int _pos;
+    
+    public void Init(byte [] buffer, int size) {
+        _buffer = buffer;
+        _size = size;
+        _pos = 0;
+    }
+    public int ReadByte() throws IOException {
+        if(_pos >= _size)
+            throw new IOException("CInByte2 - Can't read stream");
+        return (_buffer[_pos++] & 0xFF);
+    }
+    
+    int ReadBytes2(byte [] data, int size) {
+        int processedSize;
+        for(processedSize = 0; processedSize < size && _pos < _size; processedSize++)
+            data[processedSize] = _buffer[_pos++];
+        return processedSize;
+    }
+    
+    boolean ReadBytes(byte [] data, int size) {
+        int processedSize = ReadBytes2(data, size);
+        return (processedSize == size);
+    }
+    
+    int GetProcessedSize() { return _pos; }
+    
+    InByte2() {
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/MethodID.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/MethodID.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/MethodID.java	(revision 29679)
@@ -0,0 +1,60 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+class MethodID {
+    
+    static public final MethodID k_LZMA      = new MethodID(0x3, 0x1, 0x1);
+    static public final MethodID k_PPMD      = new MethodID(0x3, 0x4, 0x1);
+    static public final MethodID k_BCJ_X86   = new MethodID(0x3, 0x3, 0x1, 0x3);
+    static public final MethodID k_BCJ       = new MethodID(0x3, 0x3, 0x1, 0x3);
+    static public final MethodID k_BCJ2      = new MethodID(0x3, 0x3, 0x1, 0x1B);
+    static public final MethodID k_Deflate   = new MethodID(0x4, 0x1, 0x8);
+    static public final MethodID k_Deflate64 = new MethodID(0x4, 0x1, 0x9);
+    static public final MethodID k_BZip2     = new MethodID(0x4, 0x2, 0x2);
+    static public final MethodID k_Copy      = new MethodID(0x0);
+    static public final MethodID k_7zAES     = new MethodID(0x6, 0xF1, 0x07, 0x01);
+    
+    static final int kMethodIDSize = 15;
+    byte [] ID;
+    byte IDSize;
+    
+    public MethodID() {
+        ID = new byte[kMethodIDSize];
+        IDSize = 0;
+    }
+ 
+    public MethodID(int a) {
+        int size = 1;
+        ID = new byte[size];
+        IDSize = (byte)size;
+        ID[0] = (byte)a;
+    } 
+        
+    public MethodID(int a, int b ,int c) {
+        int size = 3;
+        ID = new byte[size];
+        IDSize = (byte)size;
+        ID[0] = (byte)a;
+        ID[1] = (byte)b;
+        ID[2] = (byte)c;
+    }    
+ 
+    public MethodID(int a, int b ,int c, int d) {
+        int size = 4;
+        ID = new byte[size];
+        IDSize = (byte)size;
+        ID[0] = (byte)a;
+        ID[1] = (byte)b;
+        ID[2] = (byte)c;
+        ID[3] = (byte)d;
+    } 
+        
+    public boolean equals(MethodID anObject) {
+        if (IDSize != anObject.IDSize) return false;
+        
+        for(int i = 0; i < IDSize ; i++) {
+            if (ID[i] != anObject.ID[i]) return false;
+        }
+        
+        return true;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/StreamSwitch.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/StreamSwitch.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZip/StreamSwitch.java	(revision 29679)
@@ -0,0 +1,47 @@
+package org.j7zip.SevenZip.Archive.SevenZip;
+
+import org.j7zip.Common.ByteBuffer;
+import org.j7zip.Common.ObjectVector;
+import org.j7zip.SevenZip.HRESULT;
+
+
+class StreamSwitch {
+    InArchive _archive;
+    boolean _needRemove;
+
+    public StreamSwitch() {
+        _needRemove = false;
+    }
+    
+    public void close() {
+        Remove();
+    }
+    
+    void Remove() {
+        if (_needRemove) {
+            _archive.DeleteByteStream();
+            _needRemove = false;
+        }
+    }
+    
+    void Set(InArchive archive, ByteBuffer byteBuffer) {
+        Set(archive, byteBuffer.data(), byteBuffer.GetCapacity());
+    }
+    
+    void Set(InArchive archive, byte [] data, int size) {
+        Remove();
+        _archive = archive;
+        _archive.AddByteStream(data, size);
+        _needRemove = true;
+    }
+    
+    int Set(InArchive archive, ObjectVector<ByteBuffer> dataVector)   throws java.io.IOException {
+        Remove();
+        int external = archive.ReadByte();
+        if (external != 0) {
+            int dataIndex = archive.ReadNum();
+            Set(archive, dataVector.get(dataIndex));
+        }
+        return HRESULT.S_OK;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZipEntry.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZipEntry.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Archive/SevenZipEntry.java	(revision 29679)
@@ -0,0 +1,100 @@
+package org.j7zip.SevenZip.Archive;
+
+public class SevenZipEntry {
+    
+    long LastWriteTime;
+    
+    long UnPackSize;
+    long PackSize;
+    
+    int Attributes;
+    long FileCRC;
+    
+    boolean IsDirectory;
+    
+    String Name;
+    String Methods;
+    
+    long Position;
+    
+    public SevenZipEntry(
+            String name,
+            long packSize,
+            long unPackSize,
+            long crc,
+            long lastWriteTime,
+            long position,
+            boolean isDir,
+            int att,
+            String methods) {
+        
+        this.Name = name;
+        this.PackSize = packSize;
+        this.UnPackSize = unPackSize;
+        this.FileCRC = crc;
+        this.LastWriteTime = lastWriteTime;
+        this.Position = position;
+        this.IsDirectory = isDir;
+        this.Attributes = att;
+        this.Methods = methods;
+    }
+    
+    public long getCompressedSize() {
+        return PackSize;
+    }
+    
+    public long getSize() {
+        return UnPackSize;
+    }
+    
+    public long getCrc() {
+        return FileCRC;
+    }
+    
+    public String getName() {
+        return Name;
+    }
+    
+    public long getTime() {
+        return LastWriteTime;
+    }
+    
+    public long getPosition() {
+        return Position;
+    }
+    
+    public boolean isDirectory() {
+        return IsDirectory;
+    }
+    
+    static final String kEmptyAttributeChar = ".";
+    static final String kDirectoryAttributeChar = "D";
+    static final String kReadonlyAttributeChar  = "R";
+    static final String kHiddenAttributeChar    = "H";
+    static final String kSystemAttributeChar    = "S";
+    static final String kArchiveAttributeChar   = "A";
+    static public final int FILE_ATTRIBUTE_READONLY =            0x00000001  ;
+    static public final int FILE_ATTRIBUTE_HIDDEN    =           0x00000002  ;
+    static public final int FILE_ATTRIBUTE_SYSTEM    =           0x00000004  ;
+    static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010;
+    static public final int FILE_ATTRIBUTE_ARCHIVE  =            0x00000020  ;
+    
+    public String getAttributesString() {
+        String ret = "";
+        ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ?
+            kDirectoryAttributeChar: kEmptyAttributeChar;
+        ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0)?
+            kReadonlyAttributeChar: kEmptyAttributeChar;
+        ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ?
+            kHiddenAttributeChar: kEmptyAttributeChar;
+        ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ?
+            kSystemAttributeChar: kEmptyAttributeChar;
+        ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ?
+            kArchiveAttributeChar: kEmptyAttributeChar;
+        return ret;
+    }
+    
+    public String getMethods() {
+        return Methods;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ArchiveExtractCallback.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ArchiveExtractCallback.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ArchiveExtractCallback.java	(revision 29679)
@@ -0,0 +1,202 @@
+package org.j7zip.SevenZip;
+
+import java.io.File;
+
+import org.j7zip.SevenZip.Archive.IArchiveExtractCallback;
+import org.j7zip.SevenZip.Archive.IInArchive;
+import org.j7zip.SevenZip.Archive.SevenZipEntry;
+
+public class ArchiveExtractCallback implements IArchiveExtractCallback // , ICryptoGetTextPassword,
+{
+    
+    class OutputStream extends java.io.OutputStream {
+        java.io.RandomAccessFile file;
+        
+        public OutputStream(java.io.RandomAccessFile f) {
+            file = f;
+        }
+        
+        public void close()  throws java.io.IOException {
+            file.close();
+            file = null;
+        }
+        /*
+        public void flush()  throws java.io.IOException {
+            file.flush();
+        }
+         */
+        public void write(byte[] b)  throws java.io.IOException {
+            file.write(b);
+        }
+        
+        public void write(byte[] b, int off, int len)  throws java.io.IOException {
+            file.write(b,off,len);
+        }
+        
+        public void write(int b)  throws java.io.IOException {
+            file.write(b);
+        }
+    }
+    
+    public int SetTotal(long size) {
+        return HRESULT.S_OK;
+    }
+    
+    public int SetCompleted(long completeValue) {
+        return HRESULT.S_OK;
+    }
+    
+    public void PrintString(String str) {
+        System.out.print(str);
+    }
+    
+    public void PrintNewLine() {
+        System.out.println("");
+    }
+    public int PrepareOperation(int askExtractMode) {
+        _extractMode = false;
+        switch (askExtractMode) {
+            case IInArchive.NExtract_NAskMode_kExtract:
+                _extractMode = true;
+        };
+        switch (askExtractMode) {
+            case IInArchive.NExtract_NAskMode_kExtract:
+                PrintString("Extracting  ");
+                break;
+            case IInArchive.NExtract_NAskMode_kTest:
+                PrintString("Testing     ");
+                break;
+            case IInArchive.NExtract_NAskMode_kSkip:
+                PrintString("Skipping    ");
+                break;
+        };
+        PrintString(_filePath);
+        return HRESULT.S_OK;
+    }
+    
+    public int SetOperationResult(int operationResult) throws java.io.IOException {
+        switch(operationResult) {
+            case IInArchive.NExtract_NOperationResult_kOK:
+                break;
+            default:
+            {
+                NumErrors++;
+                PrintString("     ");
+                switch(operationResult) {
+                    case IInArchive.NExtract_NOperationResult_kUnSupportedMethod:
+                        PrintString("Unsupported Method");
+                        break;
+                    case IInArchive.NExtract_NOperationResult_kCRCError:
+                        PrintString("CRC Failed");
+                        break;
+                    case IInArchive.NExtract_NOperationResult_kDataError:
+                        PrintString("Data Error");
+                        break;
+                    default:
+                        PrintString("Unknown Error");
+                }
+            }
+        }
+            /*
+            if(_outFileStream != null && _processedFileInfo.UTCLastWriteTimeIsDefined)
+                _outFileStreamSpec->File.SetLastWriteTime(&_processedFileInfo.UTCLastWriteTime);
+             */
+        if (_outFileStream != null) _outFileStream.close(); // _outFileStream.Release();
+            /*
+            if (_extractMode && _processedFileInfo.AttributesAreDefined)
+                NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attributes);
+             */
+        PrintNewLine();
+        return HRESULT.S_OK;
+    }
+    
+    java.io.OutputStream _outFileStream;
+    
+    public String outputDir = null;
+    
+    public int GetStream(int index,
+            java.io.OutputStream [] outStream,
+            int askExtractMode) throws java.io.IOException {
+        
+        outStream[0] = null;
+        
+        SevenZipEntry item = _archiveHandler.getEntry(index);
+        _filePath = item.getName();
+        _diskFilePath = outputDir == null ? _filePath : outputDir + File.separator + _filePath;
+        
+        file = new File(_diskFilePath);
+        
+        switch (askExtractMode) {
+            case IInArchive.NExtract_NAskMode_kTest:
+                return HRESULT.S_OK;
+                
+            case IInArchive.NExtract_NAskMode_kExtract:
+                
+                try {
+                    isDirectory = item.isDirectory();
+                    
+                    if (isDirectory) {
+                        if (file.isDirectory()) {
+                            return HRESULT.S_OK;
+                        }
+                        if (file.mkdirs())
+                            return HRESULT.S_OK;
+                        else
+                            return HRESULT.S_FALSE;
+                    }
+                    
+                    
+                    File dirs = file.getParentFile();
+                    if (dirs != null) {
+                        if (!dirs.isDirectory())
+                            if (!dirs.mkdirs())
+                                return HRESULT.S_FALSE;
+                    }
+                    
+                    long pos = item.getPosition();
+                    if (pos == -1) {
+                        file.delete();
+                    }
+                    
+                    java.io.RandomAccessFile outStr = new java.io.RandomAccessFile(_diskFilePath,"rw");
+                    
+                    if (pos != -1) {
+                        outStr.seek(pos);
+                    }
+                    
+                    outStream[0] = new OutputStream(outStr);
+                } catch (java.io.IOException e) {
+                    return HRESULT.S_FALSE;
+                }
+                
+                return HRESULT.S_OK;
+                
+        }
+        
+        // other case : skip ...
+        
+        return HRESULT.S_OK;
+        
+    }
+    
+    org.j7zip.SevenZip.Archive.IInArchive _archiveHandler;  // IInArchive
+    protected String _filePath;       // name inside archive
+    String _diskFilePath;   // full path to file on disk
+    protected File file;
+    
+    public long NumErrors;
+    boolean PasswordIsDefined;
+    String Password;
+    boolean _extractMode;
+    
+    boolean isDirectory;
+    
+    public ArchiveExtractCallback() { PasswordIsDefined = false; }
+    
+    
+    public void Init(org.j7zip.SevenZip.Archive.IInArchive archiveHandler) {
+        NumErrors = 0;
+        _archiveHandler = archiveHandler;
+    }
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/InBuffer.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/InBuffer.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/InBuffer.java	(revision 29679)
@@ -0,0 +1,74 @@
+package org.j7zip.SevenZip.Common;
+
+
+public class InBuffer {
+    int _bufferPos;
+    int _bufferLimit;
+    byte [] _bufferBase;
+    java.io.InputStream _stream = null; // CMyComPtr<ISequentialInStream>
+    long _processedSize;
+    int _bufferSize;
+    boolean _wasFinished;
+    
+    public InBuffer() {
+        
+    }
+    // ~CInBuffer() { Free(); }
+    
+    public void Create(int bufferSize) {
+        final int kMinBlockSize = 1;
+        if (bufferSize < kMinBlockSize)
+            bufferSize = kMinBlockSize;
+        if (_bufferBase != null && _bufferSize == bufferSize)
+            return ;
+        Free();
+        _bufferSize = bufferSize;
+        _bufferBase = new byte[bufferSize];
+    }
+    void Free() {
+        _bufferBase = null;
+    }
+    
+    public void SetStream(java.io.InputStream stream) { // ISequentialInStream
+        _stream = stream;
+    }
+    public void Init() {
+        _processedSize = 0;
+        _bufferPos = 0; //  = _bufferBase;
+        _bufferLimit = 0; // _buffer;
+        _wasFinished = false;
+    }
+    public void ReleaseStream() throws java.io.IOException {
+        if (_stream != null) _stream.close(); // _stream.Release();
+        _stream = null;
+    }
+    
+    public int read()  throws java.io.IOException {
+        if(_bufferPos >= _bufferLimit)
+            return ReadBlock2();
+        return _bufferBase[_bufferPos++] & 0xFF;
+    }
+    
+    public boolean ReadBlock() throws java.io.IOException {
+        if (_wasFinished)
+            return false;
+        _processedSize += _bufferPos; // (_buffer - _bufferBase);
+        
+        int  numProcessedBytes = _stream.read(_bufferBase, 0,_bufferSize);
+        if (numProcessedBytes == -1) numProcessedBytes = 0; // EOF
+        
+        _bufferPos = 0; // _bufferBase;
+        _bufferLimit = numProcessedBytes; // _buffer + numProcessedBytes;
+        _wasFinished = (numProcessedBytes == 0);
+        return (!_wasFinished);
+    }
+    
+    public int ReadBlock2() throws java.io.IOException {
+        if(!ReadBlock())
+            return -1; // 0xFF;
+        return _bufferBase[_bufferPos++] & 0xFF;
+    }
+    
+    public long GetProcessedSize() { return _processedSize + (_bufferPos); }
+    public boolean WasFinished() { return _wasFinished; }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/LocalCompressProgressInfo.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/LocalCompressProgressInfo.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/LocalCompressProgressInfo.java	(revision 29679)
@@ -0,0 +1,45 @@
+package org.j7zip.SevenZip.Common;
+
+import org.j7zip.SevenZip.ICompressProgressInfo;
+
+
+public class LocalCompressProgressInfo implements ICompressProgressInfo {
+    ICompressProgressInfo _progress;
+
+    boolean _inStartValueIsAssigned;
+    boolean _outStartValueIsAssigned;
+    long _inStartValue;
+    long _outStartValue;
+
+    public void Init(ICompressProgressInfo progress, long inStartValue, long outStartValue) {
+
+        _progress = progress;
+        _inStartValueIsAssigned = (inStartValue != ICompressProgressInfo.INVALID);
+        if (_inStartValueIsAssigned)
+            _inStartValue = inStartValue;
+        _outStartValueIsAssigned = (outStartValue != ICompressProgressInfo.INVALID);
+        if (_outStartValueIsAssigned)
+            _outStartValue = outStartValue;
+
+    }
+    
+    public int SetRatioInfo(long inSize, long outSize) {
+        long inSizeNew, outSizeNew;
+        long inSizeNewPointer;
+        long outSizeNewPointer;
+        if (_inStartValueIsAssigned && inSize != ICompressProgressInfo.INVALID) {
+            inSizeNew = _inStartValue + (inSize); // *inSize
+            inSizeNewPointer = inSizeNew;
+        } else
+            inSizeNewPointer = ICompressProgressInfo.INVALID;
+        
+        if (_outStartValueIsAssigned && outSize != ICompressProgressInfo.INVALID) {
+            outSizeNew = _outStartValue + (outSize);
+            outSizeNewPointer = outSizeNew;
+        } else
+            outSizeNewPointer = ICompressProgressInfo.INVALID;
+        return _progress.SetRatioInfo(inSizeNewPointer, outSizeNewPointer);
+        
+    }
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/LocalProgress.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/LocalProgress.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/LocalProgress.java	(revision 29679)
@@ -0,0 +1,21 @@
+package org.j7zip.SevenZip.Common;
+
+import org.j7zip.SevenZip.ICompressProgressInfo;
+import org.j7zip.SevenZip.IProgress;
+
+
+public class LocalProgress implements ICompressProgressInfo {
+    IProgress _progress;
+    boolean _inSizeIsMain;
+    
+    public void Init(IProgress progress, boolean inSizeIsMain) {
+        _progress = progress;
+        _inSizeIsMain = inSizeIsMain;
+    }
+    
+    public int SetRatioInfo(long inSize, long outSize) {
+        return _progress.SetCompleted(_inSizeIsMain ? inSize : outSize);
+        
+    }
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/SequentialOutStreamImp2.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/SequentialOutStreamImp2.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/SequentialOutStreamImp2.java	(revision 29679)
@@ -0,0 +1,28 @@
+package org.j7zip.SevenZip.Common;
+
+
+public class SequentialOutStreamImp2 extends java.io.OutputStream {
+    byte []_buffer;
+    int _size;
+    int _pos;
+    public void Init(byte [] buffer, int size) {
+        _buffer = buffer;
+        _pos = 0;
+        _size = size;
+    }
+    
+    public void write(int b) throws java.io.IOException {
+        throw new java.io.IOException("SequentialOutStreamImp2 - write() not implemented");
+    }
+    
+    public void write(byte [] data,int off, int size) throws java.io.IOException {
+        for(int i = 0 ; i < size ; i++) {
+            if (_pos < _size) {
+                _buffer[_pos++] = data[off + i];
+            } else {
+                throw new java.io.IOException("SequentialOutStreamImp2 - can't write");
+            }
+        }
+    }
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/StreamUtils.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/StreamUtils.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Common/StreamUtils.java	(revision 29679)
@@ -0,0 +1,28 @@
+package org.j7zip.SevenZip.Common;
+
+import java.io.IOException;
+
+public class StreamUtils
+{    
+    static public int  ReadStream(java.io.InputStream stream, byte [] data,int off, int size) throws IOException
+    {
+        int processedSize = 0;
+
+        while(size != 0)
+        {
+             int processedSizeLoc = stream.read(data,off + processedSize,size);
+             if (processedSizeLoc > 0)
+             {
+                processedSize += processedSizeLoc;
+                size -= processedSizeLoc;
+             }
+             if (processedSizeLoc == -1) {
+                 if (processedSize > 0) return processedSize;
+                 return -1; // EOF
+             }
+        }
+        return processedSize;
+    }
+    
+    // HRESULT WriteStream(ISequentialOutStream *stream, const void *data, UInt32 size, UInt32 *processedSize);
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/Branch/BCJ2_x86_Decoder.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/Branch/BCJ2_x86_Decoder.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/Branch/BCJ2_x86_Decoder.java	(revision 29679)
@@ -0,0 +1,185 @@
+
+package org.j7zip.SevenZip.Compression.Branch;
+
+import org.j7zip.Common.RecordVector;
+import org.j7zip.SevenZip.HRESULT;
+import org.j7zip.SevenZip.ICompressCoder2;
+import org.j7zip.SevenZip.ICompressProgressInfo;
+import org.j7zip.SevenZip.Common.InBuffer;
+import org.j7zip.SevenZip.Compression.LZ.OutWindow;
+
+
+public class BCJ2_x86_Decoder implements ICompressCoder2 {
+
+    public static final int kNumMoveBits = 5;
+    
+    InBuffer _mainInStream = new InBuffer();
+    InBuffer _callStream = new InBuffer();
+    InBuffer _jumpStream = new InBuffer();
+    
+    org.j7zip.SevenZip.Compression.RangeCoder.BitDecoder _statusE8Decoder[] = new org.j7zip.SevenZip.Compression.RangeCoder.BitDecoder[256];
+    org.j7zip.SevenZip.Compression.RangeCoder.BitDecoder _statusE9Decoder = new org.j7zip.SevenZip.Compression.RangeCoder.BitDecoder(kNumMoveBits);
+    org.j7zip.SevenZip.Compression.RangeCoder.BitDecoder _statusJccDecoder = new org.j7zip.SevenZip.Compression.RangeCoder.BitDecoder(kNumMoveBits);
+    
+    OutWindow _outStream = new OutWindow();
+    org.j7zip.SevenZip.Compression.RangeCoder.Decoder _rangeDecoder = new org.j7zip.SevenZip.Compression.RangeCoder.Decoder();
+    
+    
+    // static final boolean IsJcc(int b0, int b1) {
+    //     return ((b0 == 0x0F) && ((b1 & 0xF0) == 0x80));
+    // }
+    
+    int CodeReal(
+            RecordVector<java.io.InputStream>  inStreams,
+            Object useless1, // const UInt64 ** /* inSizes */,
+            int numInStreams,
+            RecordVector<java.io.OutputStream> outStreams,
+            Object useless2, // const UInt64 ** /* outSizes */,
+            int numOutStreams,
+            ICompressProgressInfo progress) throws java.io.IOException {
+        
+        if (numInStreams != 4 || numOutStreams != 1)
+            return HRESULT.E_INVALIDARG;
+        
+        _mainInStream.Create(1 << 16);
+        _callStream.Create(1 << 20);
+        _jumpStream.Create(1 << 16);
+        _rangeDecoder.Create(1 << 20);
+        _outStream.Create(1 << 16);
+        
+        _mainInStream.SetStream(inStreams.get(0));
+        _callStream.SetStream(inStreams.get(1));
+        _jumpStream.SetStream(inStreams.get(2));
+        _rangeDecoder.SetStream(inStreams.get(3));
+        _outStream.SetStream(outStreams.get(0));
+        
+        _mainInStream.Init();
+        _callStream.Init();
+        _jumpStream.Init();
+        _rangeDecoder.Init();
+        _outStream.Init();
+        
+        for (int i = 0; i < 256; i++) {
+            _statusE8Decoder[i] = new org.j7zip.SevenZip.Compression.RangeCoder.BitDecoder(kNumMoveBits);
+            _statusE8Decoder[i].Init();
+        }
+        _statusE9Decoder.Init();
+        _statusJccDecoder.Init();
+        
+        int prevByte = 0;
+        int processedBytes = 0;
+        for (;;) {
+            
+            if (processedBytes > (1 << 20) && progress != null) {
+                long nowPos64 = _outStream.GetProcessedSize();
+                int res = progress.SetRatioInfo(ICompressProgressInfo.INVALID, nowPos64);
+                if (res != HRESULT.S_OK) return res;
+                
+                processedBytes = 0;
+            }
+            
+            processedBytes++;
+            int b = _mainInStream.read();
+            if (b == -1)
+                return Flush();
+            _outStream.WriteByte(b); // System.out.println("0:"+b);
+            // if ((b != 0xE8) && (b != 0xE9) && (!IsJcc(prevByte, b))) {
+            if ((b != 0xE8) && (b != 0xE9) && (!((prevByte == 0x0F) && ((b & 0xF0) == 0x80)))) {
+                prevByte = b;
+                continue;
+            }
+            
+            boolean status;
+            if (b == 0xE8)
+                status = (_statusE8Decoder[prevByte].Decode(_rangeDecoder) == 1);
+            else if (b == 0xE9)
+                status = (_statusE9Decoder.Decode(_rangeDecoder) == 1);
+            else
+                status = (_statusJccDecoder.Decode(_rangeDecoder) == 1);
+            
+            if (status) {
+                int src;
+                if (b == 0xE8) {
+                    int b0 = _callStream.read();
+                    // if(b0 == -1) return HRESULT.S_FALSE;
+                    src = ((int)b0) << 24;
+                    
+                    b0 = _callStream.read();
+                    // if(b0 == -1) return HRESULT.S_FALSE;
+                    src |= ((int)b0) << 16;
+                    
+                    b0 = _callStream.read();
+                    // if(b0 == -1) return HRESULT.S_FALSE;
+                    src |= ((int)b0) << 8;
+                    
+                    b0 = _callStream.read();
+                    if(b0 == -1) return HRESULT.S_FALSE;
+                    src |= ((int)b0);
+                    
+                } else {
+                    int b0 = _jumpStream.read();
+                    // if(b0 == -1) return HRESULT.S_FALSE;
+                    src = ((int)b0) << 24;
+                    
+                    b0 = _jumpStream.read();
+                    // if(b0 == -1) return HRESULT.S_FALSE;
+                    src |= ((int)b0) << 16;
+                    
+                    b0 = _jumpStream.read();
+                    // if(b0 == -1) return HRESULT.S_FALSE;
+                    src |= ((int)b0) << 8;
+                    
+                    b0 = _jumpStream.read();
+                    if(b0 == -1) return HRESULT.S_FALSE;
+                    src |= ((int)b0);
+                    
+                }
+                int dest = src - ((int)_outStream.GetProcessedSize() + 4) ;
+                _outStream.WriteByte(dest);
+                _outStream.WriteByte((dest >> 8));
+                _outStream.WriteByte((dest >> 16));
+                _outStream.WriteByte((dest >> 24));
+                prevByte = (int)(dest >> 24) & 0xFF;
+                processedBytes += 4;
+            } else
+                prevByte = b;
+        }
+    }
+    
+    public int Flush() throws java.io.IOException {
+        _outStream.Flush();
+        return HRESULT.S_OK;
+    }
+    
+    public int Code(
+            RecordVector<java.io.InputStream>  inStreams, // ISequentialInStream **inStreams,
+            Object useless_inSizes, // const UInt64 ** /* inSizes */,
+            int numInStreams,
+            RecordVector<java.io.OutputStream> outStreams, // ISequentialOutStream **outStreams
+            Object useless_outSizes, // const UInt64 ** /* outSizes */,
+            int numOutStreams,
+            ICompressProgressInfo progress) throws java.io.IOException {
+        
+        try {
+            return CodeReal(inStreams, useless_inSizes, numInStreams,
+                    outStreams, useless_outSizes,numOutStreams, progress);
+        } catch(java.io.IOException e) {
+            throw e;
+        } finally {
+            ReleaseStreams();
+        }
+    }
+    
+    void ReleaseStreams() throws java.io.IOException {
+        _mainInStream.ReleaseStream();
+        _callStream.ReleaseStream();
+        _jumpStream.ReleaseStream();
+        _rangeDecoder.ReleaseStream();
+        _outStream.ReleaseStream();
+    }
+    
+    public void close() throws java.io.IOException {
+        ReleaseStreams();       
+    }
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/Branch/BCJ_x86_Decoder.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/Branch/BCJ_x86_Decoder.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/Branch/BCJ_x86_Decoder.java	(revision 29679)
@@ -0,0 +1,114 @@
+package org.j7zip.SevenZip.Compression.Branch;
+
+import org.j7zip.SevenZip.HRESULT;
+import org.j7zip.SevenZip.ICompressFilter;
+
+public class BCJ_x86_Decoder implements ICompressFilter {
+    
+    // struct CBranch86 - begin
+    int  [] _prevMask = new int[1];  // UInt32
+    int  [] _prevPos = new int[1]; // UInt32
+    void x86Init() {
+        _prevMask[0] = 0;
+        _prevPos[0] = -5;
+    }
+    // struct CBranch86 - end
+        
+    static final boolean [] kMaskToAllowedStatus = {true, true, true, false, true, false, false, false };
+    
+    static final int [] kMaskToBitNumber = {0, 1, 2, 2, 3, 3, 3, 3};
+    
+    static final boolean Test86MSByte(int b) { return ((b) == 0 || (b) == 0xFF); }
+    
+    static final int x86_Convert(byte [] buffer, int endPos, int nowPos,
+            int [] prevMask, int [] prevPos, boolean encoding) {
+        int bufferPos = 0;
+        int limit;
+        
+        if (endPos < 5)
+            return 0;
+        
+        if (nowPos - prevPos[0] > 5)
+            prevPos[0] = nowPos - 5;
+        
+        limit = endPos - 5;
+        while(bufferPos <= limit) {
+            int b = (buffer[bufferPos] & 0xFF);
+            int offset;
+            if (b != 0xE8 && b != 0xE9) {
+                bufferPos++;
+                continue;
+            }
+            offset = (nowPos + bufferPos - prevPos[0]);
+            prevPos[0] = (nowPos + bufferPos);
+            if (offset > 5)
+                prevMask[0] = 0;
+            else {
+                for (int i = 0; i < offset; i++) {
+                    prevMask[0] &= 0x77;
+                    prevMask[0] <<= 1;
+                }
+            }
+            b = (buffer[bufferPos + 4] & 0xFF);
+            if (Test86MSByte(b) && kMaskToAllowedStatus[(prevMask[0] >> 1) & 0x7] &&
+                    (prevMask[0] >>> 1) < 0x10) {
+                int src =
+                        ((int)(b) << 24) |
+                        ((int)(buffer[bufferPos + 3] & 0xFF) << 16) |
+                        ((int)(buffer[bufferPos + 2] & 0xFF) << 8) |
+                        (buffer[bufferPos + 1] & 0xFF);
+                
+                int dest;
+                for (;;) {
+                    int index;
+                    if (encoding)
+                        dest = (nowPos + bufferPos + 5) + src;
+                    else
+                        dest = src - (nowPos + bufferPos + 5);
+                    if (prevMask[0] == 0)
+                        break;
+                    index = kMaskToBitNumber[prevMask[0] >>> 1];
+                    b = (int)((dest >> (24 - index * 8)) & 0xFF);
+                    if (!Test86MSByte(b))
+                        break;
+                    src = dest ^ ((1 << (32 - index * 8)) - 1);
+                }
+                buffer[bufferPos + 4] = (byte)(~(((dest >> 24) & 1) - 1));
+                buffer[bufferPos + 3] = (byte)(dest >> 16);
+                buffer[bufferPos + 2] = (byte)(dest >> 8);
+                buffer[bufferPos + 1] = (byte)dest;
+                bufferPos += 5;
+                prevMask[0] = 0;
+            } else {
+                bufferPos++;
+                prevMask[0] |= 1;
+                if (Test86MSByte(b))
+                    prevMask[0] |= 0x10;
+            }
+        }
+        return bufferPos;
+    }
+    
+    public int SubFilter(byte [] data, int size) {
+        return x86_Convert(data, size, _bufferPos, _prevMask, _prevPos, false);
+    }
+    
+    public void SubInit() {
+        x86Init();
+    }
+  
+    int   _bufferPos; // UInt32
+    
+    // ICompressFilter interface
+    public int Init() {
+        _bufferPos = 0;
+        SubInit();
+        return HRESULT.S_OK;
+    }
+    
+    public int Filter(byte [] data, int size) {
+        int processedSize = SubFilter(data, size);
+        _bufferPos += processedSize;
+        return processedSize;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/Copy/Decoder.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/Copy/Decoder.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/Copy/Decoder.java	(revision 29679)
@@ -0,0 +1,41 @@
+
+package org.j7zip.SevenZip.Compression.Copy;
+
+import org.j7zip.SevenZip.HRESULT;
+import org.j7zip.SevenZip.ICompressCoder;
+import org.j7zip.SevenZip.ICompressProgressInfo;
+
+
+public class Decoder implements ICompressCoder {
+    
+    static final int kBufferSize = 1 << 17;
+    
+    public int Code(
+            java.io.InputStream inStream, // , ISequentialInStream
+            java.io.OutputStream outStream, // ISequentialOutStream
+            long outSize, ICompressProgressInfo progress) throws java.io.IOException {
+        
+        byte [] _buffer = new byte[kBufferSize];
+        long TotalSize = 0;
+        
+        for (;;) {
+            int realProcessedSize;
+            int size = kBufferSize;
+            
+            if (outSize != -1) // NULL
+                if (size > (outSize - TotalSize))
+                    size = (int)(outSize - TotalSize);
+            
+            realProcessedSize = inStream.read(_buffer, 0,size);
+            if(realProcessedSize == -1) // EOF
+                break;
+            outStream.write(_buffer,0,realProcessedSize);
+            TotalSize += realProcessedSize;
+            if (progress != null) {
+                int res = progress.SetRatioInfo(TotalSize, TotalSize);
+                if (res != HRESULT.S_OK) return res;
+            }
+        }
+        return HRESULT.S_OK;  
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZ/BinTree.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZ/BinTree.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZ/BinTree.java	(revision 29679)
@@ -0,0 +1,382 @@
+// LZ.BinTree
+
+package org.j7zip.SevenZip.Compression.LZ;
+import java.io.IOException;
+
+
+public class BinTree extends InWindow
+{
+	int _cyclicBufferPos;
+	int _cyclicBufferSize = 0;
+	int _matchMaxLen;
+	
+	int[] _son;
+	int[] _hash;
+	
+	int _cutValue = 0xFF;
+	int _hashMask;
+	int _hashSizeSum = 0;
+	
+	boolean HASH_ARRAY = true;
+
+	static final int kHash2Size = 1 << 10;
+	static final int kHash3Size = 1 << 16;
+	static final int kBT2HashSize = 1 << 16;
+	static final int kStartMaxLen = 1;
+	static final int kHash3Offset = kHash2Size;
+	static final int kEmptyHashValue = 0;
+	static final int kMaxValForNormalize = (1 << 30) - 1;
+	
+	int kNumHashDirectBytes = 0;
+	int kMinMatchCheck = 4;
+	int kFixHashSize = kHash2Size + kHash3Size;
+
+	public void SetType(int numHashBytes)
+	{
+		HASH_ARRAY = (numHashBytes > 2);
+		if (HASH_ARRAY)
+		{
+			kNumHashDirectBytes = 0;
+			kMinMatchCheck = 4;
+			kFixHashSize = kHash2Size + kHash3Size;
+		}
+		else
+		{
+			kNumHashDirectBytes = 2;
+			kMinMatchCheck = 2 + 1;
+			kFixHashSize = 0;
+		}
+	}
+	
+
+	
+
+	public void Init() throws IOException
+	{
+		super.Init();
+		for (int i = 0; i < _hashSizeSum; i++)
+			_hash[i] = kEmptyHashValue;
+		_cyclicBufferPos = 0;
+		ReduceOffsets(-1);
+	}
+	
+	public void MovePos() throws IOException
+	{
+		if (++_cyclicBufferPos >= _cyclicBufferSize)
+			_cyclicBufferPos = 0;
+		super.MovePos();
+		if (_pos == kMaxValForNormalize)
+			Normalize();
+	}
+	
+
+	
+	
+	
+	
+	
+	
+	public boolean Create(int historySize, int keepAddBufferBefore,
+			int matchMaxLen, int keepAddBufferAfter)
+	{
+		if (historySize > kMaxValForNormalize - 256)
+			return false;
+		_cutValue = 16 + (matchMaxLen >> 1);
+
+		int windowReservSize = (historySize + keepAddBufferBefore +
+				matchMaxLen + keepAddBufferAfter) / 2 + 256;
+		
+		super.Create(historySize + keepAddBufferBefore, matchMaxLen + keepAddBufferAfter, windowReservSize);
+		
+		_matchMaxLen = matchMaxLen;
+
+		int cyclicBufferSize = historySize + 1;
+		if (_cyclicBufferSize != cyclicBufferSize)
+			_son = new int[(_cyclicBufferSize = cyclicBufferSize) * 2];
+
+		int hs = kBT2HashSize;
+
+		if (HASH_ARRAY)
+		{
+			hs = historySize - 1;
+			hs |= (hs >> 1);
+			hs |= (hs >> 2);
+			hs |= (hs >> 4);
+			hs |= (hs >> 8);
+			hs >>= 1;
+			hs |= 0xFFFF;
+			if (hs > (1 << 24))
+				hs >>= 1;
+			_hashMask = hs;
+			hs++;
+			hs += kFixHashSize;
+		}
+		if (hs != _hashSizeSum)
+			_hash = new int [_hashSizeSum = hs];
+		return true;
+	}
+	public int GetMatches(int[] distances) throws IOException
+	{
+		int lenLimit;
+		if (_pos + _matchMaxLen <= _streamPos)
+			lenLimit = _matchMaxLen;
+		else
+		{
+			lenLimit = _streamPos - _pos;
+			if (lenLimit < kMinMatchCheck)
+			{
+				MovePos();
+				return 0;
+			}
+		}
+
+		int offset = 0;
+		int matchMinPos = (_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0;
+		int cur = _bufferOffset + _pos;
+		int maxLen = kStartMaxLen; // to avoid items for len < hashSize;
+		int hashValue, hash2Value = 0, hash3Value = 0;
+		
+		if (HASH_ARRAY)
+		{
+			int temp = CrcTable[_bufferBase[cur] & 0xFF] ^ (_bufferBase[cur + 1] & 0xFF);
+			hash2Value = temp & (kHash2Size - 1);
+			temp ^= ((int)(_bufferBase[cur + 2] & 0xFF) << 8);
+			hash3Value = temp & (kHash3Size - 1);
+			hashValue = (temp ^ (CrcTable[_bufferBase[cur + 3] & 0xFF] << 5)) & _hashMask;
+		}
+		else
+			hashValue = ((_bufferBase[cur] & 0xFF) ^ ((int)(_bufferBase[cur + 1] & 0xFF) << 8));
+
+		int curMatch = _hash[kFixHashSize + hashValue];
+		if (HASH_ARRAY)
+		{
+			int curMatch2 = _hash[hash2Value];
+			int curMatch3 = _hash[kHash3Offset + hash3Value];
+			_hash[hash2Value] = _pos;
+			_hash[kHash3Offset + hash3Value] = _pos;
+			if (curMatch2 > matchMinPos)
+				if (_bufferBase[_bufferOffset + curMatch2] == _bufferBase[cur])
+				{
+					distances[offset++] = maxLen = 2;
+					distances[offset++] = _pos - curMatch2 - 1;
+				}
+			if (curMatch3 > matchMinPos)
+				if (_bufferBase[_bufferOffset + curMatch3] == _bufferBase[cur])
+				{
+					if (curMatch3 == curMatch2)
+						offset -= 2;
+					distances[offset++] = maxLen = 3;
+					distances[offset++] = _pos - curMatch3 - 1;
+					curMatch2 = curMatch3;
+				}
+			if (offset != 0 && curMatch2 == curMatch)
+			{
+				offset -= 2;
+				maxLen = kStartMaxLen;
+			}
+		}
+
+		_hash[kFixHashSize + hashValue] = _pos;
+
+		int ptr0 = (_cyclicBufferPos << 1) + 1;
+		int ptr1 = (_cyclicBufferPos << 1);
+
+		int len0, len1;
+		len0 = len1 = kNumHashDirectBytes;
+
+		if (kNumHashDirectBytes != 0)
+		{
+			if (curMatch > matchMinPos)
+			{
+				if (_bufferBase[_bufferOffset + curMatch + kNumHashDirectBytes] !=
+						_bufferBase[cur + kNumHashDirectBytes])
+				{
+					distances[offset++] = maxLen = kNumHashDirectBytes;
+					distances[offset++] = _pos - curMatch - 1;
+				}
+			}
+		}
+
+		int count = _cutValue;
+
+		while (true)
+		{
+			if (curMatch <= matchMinPos || count-- == 0)
+			{
+				_son[ptr0] = _son[ptr1] = kEmptyHashValue;
+				break;
+			}
+			int delta = _pos - curMatch;
+			int cyclicPos = ((delta <= _cyclicBufferPos) ?
+				(_cyclicBufferPos - delta) :
+				(_cyclicBufferPos - delta + _cyclicBufferSize)) << 1;
+
+			int pby1 = _bufferOffset + curMatch;
+			int len = Math.min(len0, len1);
+			if (_bufferBase[pby1 + len] == _bufferBase[cur + len])
+			{
+				while(++len != lenLimit)
+					if (_bufferBase[pby1 + len] != _bufferBase[cur + len])
+						break;
+				if (maxLen < len)
+				{
+					distances[offset++] = maxLen = len;
+					distances[offset++] = delta - 1;
+					if (len == lenLimit)
+					{
+						_son[ptr1] = _son[cyclicPos];
+						_son[ptr0] = _son[cyclicPos + 1];
+						break;
+					}
+				}
+			}
+			if ((_bufferBase[pby1 + len] & 0xFF) < (_bufferBase[cur + len] & 0xFF))
+			{
+				_son[ptr1] = curMatch;
+				ptr1 = cyclicPos + 1;
+				curMatch = _son[ptr1];
+				len1 = len;
+			}
+			else
+			{
+				_son[ptr0] = curMatch;
+				ptr0 = cyclicPos;
+				curMatch = _son[ptr0];
+				len0 = len;
+			}
+		}
+		MovePos();
+		return offset;
+	}
+
+	public void Skip(int num) throws IOException
+	{
+		do
+		{
+			int lenLimit;
+			if (_pos + _matchMaxLen <= _streamPos)
+			lenLimit = _matchMaxLen;
+			else
+			{
+				lenLimit = _streamPos - _pos;
+				if (lenLimit < kMinMatchCheck)
+				{
+					MovePos();
+					continue;
+				}
+			}
+
+			int matchMinPos = (_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0;
+			int cur = _bufferOffset + _pos;
+			
+			int hashValue;
+
+			if (HASH_ARRAY)
+			{
+				int temp = CrcTable[_bufferBase[cur] & 0xFF] ^ (_bufferBase[cur + 1] & 0xFF);
+				int hash2Value = temp & (kHash2Size - 1);
+				_hash[hash2Value] = _pos;
+				temp ^= ((int)(_bufferBase[cur + 2] & 0xFF) << 8);
+				int hash3Value = temp & (kHash3Size - 1);
+				_hash[kHash3Offset + hash3Value] = _pos;
+				hashValue = (temp ^ (CrcTable[_bufferBase[cur + 3] & 0xFF] << 5)) & _hashMask;
+			}
+			else
+				hashValue = ((_bufferBase[cur] & 0xFF) ^ ((int)(_bufferBase[cur + 1] & 0xFF) << 8));
+
+			int curMatch = _hash[kFixHashSize + hashValue];
+			_hash[kFixHashSize + hashValue] = _pos;
+
+			int ptr0 = (_cyclicBufferPos << 1) + 1;
+			int ptr1 = (_cyclicBufferPos << 1);
+
+			int len0, len1;
+			len0 = len1 = kNumHashDirectBytes;
+
+			int count = _cutValue;
+			while (true)
+			{
+				if (curMatch <= matchMinPos || count-- == 0)
+				{
+					_son[ptr0] = _son[ptr1] = kEmptyHashValue;
+					break;
+				}
+
+				int delta = _pos - curMatch;
+				int cyclicPos = ((delta <= _cyclicBufferPos) ?
+					(_cyclicBufferPos - delta) :
+					(_cyclicBufferPos - delta + _cyclicBufferSize)) << 1;
+
+				int pby1 = _bufferOffset + curMatch;
+				int len = Math.min(len0, len1);
+				if (_bufferBase[pby1 + len] == _bufferBase[cur + len])
+				{
+					while (++len != lenLimit)
+						if (_bufferBase[pby1 + len] != _bufferBase[cur + len])
+							break;
+					if (len == lenLimit)
+					{
+						_son[ptr1] = _son[cyclicPos];
+						_son[ptr0] = _son[cyclicPos + 1];
+						break;
+					}
+				}
+				if ((_bufferBase[pby1 + len] & 0xFF) < (_bufferBase[cur + len] & 0xFF))
+				{
+					_son[ptr1] = curMatch;
+					ptr1 = cyclicPos + 1;
+					curMatch = _son[ptr1];
+					len1 = len;
+				}
+				else
+				{
+					_son[ptr0] = curMatch;
+					ptr0 = cyclicPos;
+					curMatch = _son[ptr0];
+					len0 = len;
+				}
+			}
+			MovePos();
+		}
+		while (--num != 0);
+	}
+	
+	void NormalizeLinks(int[] items, int numItems, int subValue)
+	{
+		for (int i = 0; i < numItems; i++)
+		{
+			int value = items[i];
+			if (value <= subValue)
+				value = kEmptyHashValue;
+			else
+				value -= subValue;
+			items[i] = value;
+		}
+	}
+	
+	void Normalize()
+	{
+		int subValue = _pos - _cyclicBufferSize;
+		NormalizeLinks(_son, _cyclicBufferSize * 2, subValue);
+		NormalizeLinks(_hash, _hashSizeSum, subValue);
+		ReduceOffsets(subValue);
+	}
+	
+	public void SetCutValue(int cutValue) { _cutValue = cutValue; }
+
+	private static final int[] CrcTable = new int[256];
+
+	static
+	{
+		for (int i = 0; i < 256; i++)
+		{
+			int r = i;
+			for (int j = 0; j < 8; j++)
+				if ((r & 1) != 0)
+					r = (r >>> 1) ^ 0xEDB88320;
+				else
+					r >>>= 1;
+			CrcTable[i] = r;
+		}
+	}
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZ/InWindow.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZ/InWindow.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZ/InWindow.java	(revision 29679)
@@ -0,0 +1,131 @@
+// LZ.InWindow
+
+package org.j7zip.SevenZip.Compression.LZ;
+
+import java.io.IOException;
+
+public class InWindow
+{
+	public byte[] _bufferBase; // pointer to buffer with data
+	java.io.InputStream _stream;
+	int _posLimit;  // offset (from _buffer) of first byte when new block reading must be done
+	boolean _streamEndWasReached; // if (true) then _streamPos shows real end of stream
+	
+	int _pointerToLastSafePosition;
+	
+	public int _bufferOffset;
+	
+	public int _blockSize;  // Size of Allocated memory block
+	public int _pos;             // offset (from _buffer) of curent byte
+	int _keepSizeBefore;  // how many BYTEs must be kept in buffer before _pos
+	int _keepSizeAfter;   // how many BYTEs must be kept buffer after _pos
+	public int _streamPos;   // offset (from _buffer) of first not read byte from Stream
+	
+	public void MoveBlock()
+	{
+		int offset = _bufferOffset + _pos - _keepSizeBefore;
+		// we need one additional byte, since MovePos moves on 1 byte.
+		if (offset > 0)
+			offset--;
+
+		int numBytes = _bufferOffset + _streamPos - offset;
+		
+		// check negative offset ????
+		for (int i = 0; i < numBytes; i++)
+			_bufferBase[i] = _bufferBase[offset + i];
+		_bufferOffset -= offset;
+	}
+	
+	public void ReadBlock() throws IOException
+	{
+		if (_streamEndWasReached)
+			return;
+		while (true)
+		{
+			int size = (0 - _bufferOffset) + _blockSize - _streamPos;
+			if (size == 0)
+				return;
+			int numReadBytes = _stream.read(_bufferBase, _bufferOffset + _streamPos, size);
+			if (numReadBytes == -1)
+			{
+				_posLimit = _streamPos;
+				int pointerToPostion = _bufferOffset + _posLimit;
+				if (pointerToPostion > _pointerToLastSafePosition)
+					_posLimit = _pointerToLastSafePosition - _bufferOffset;
+				
+				_streamEndWasReached = true;
+				return;
+			}
+			_streamPos += numReadBytes;
+			if (_streamPos >= _pos + _keepSizeAfter)
+				_posLimit = _streamPos - _keepSizeAfter;
+		}
+	}
+	
+	void Free() { _bufferBase = null; }
+	
+	public void Create(int keepSizeBefore, int keepSizeAfter, int keepSizeReserv)
+	{
+		_keepSizeBefore = keepSizeBefore;
+		_keepSizeAfter = keepSizeAfter;
+		int blockSize = keepSizeBefore + keepSizeAfter + keepSizeReserv;
+		if (_bufferBase == null || _blockSize != blockSize)
+		{
+			Free();
+			_blockSize = blockSize;
+			_bufferBase = new byte[_blockSize];
+		}
+		_pointerToLastSafePosition = _blockSize - keepSizeAfter;
+	}
+	
+	public void SetStream(java.io.InputStream stream) { _stream = stream; 	}
+	public void ReleaseStream() { _stream = null; }
+
+	public void Init() throws IOException
+	{
+		_bufferOffset = 0;
+		_pos = 0;
+		_streamPos = 0;
+		_streamEndWasReached = false;
+		ReadBlock();
+	}
+	
+	public void MovePos() throws IOException
+	{
+		_pos++;
+		if (_pos > _posLimit)
+		{
+			int pointerToPostion = _bufferOffset + _pos;
+			if (pointerToPostion > _pointerToLastSafePosition)
+				MoveBlock();
+			ReadBlock();
+		}
+	}
+	
+	public byte GetIndexByte(int index)	{ return _bufferBase[_bufferOffset + _pos + index]; }
+	
+	// index + limit have not to exceed _keepSizeAfter;
+	public int GetMatchLen(int index, int distance, int limit)
+	{
+		if (_streamEndWasReached)
+			if ((_pos + index) + limit > _streamPos)
+				limit = _streamPos - (_pos + index);
+		distance++;
+		// Byte *pby = _buffer + (size_t)_pos + index;
+		int pby = _bufferOffset + _pos + index;
+		
+		int i;
+		for (i = 0; i < limit && _bufferBase[pby + i] == _bufferBase[pby + i - distance]; i++);
+		return i;
+	}
+	
+	public int GetNumAvailableBytes()	{ return _streamPos - _pos; }
+	
+	public void ReduceOffsets(int subValue)
+	{
+		_bufferOffset += subValue;
+		_posLimit -= subValue;
+		_pos -= subValue;
+		_streamPos -= subValue;
+	}
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZ/OutWindow.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZ/OutWindow.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZ/OutWindow.java	(revision 29679)
@@ -0,0 +1,107 @@
+// LZ.OutWindow
+
+package org.j7zip.SevenZip.Compression.LZ;
+
+import java.io.IOException;
+
+public class OutWindow {
+    byte[] _buffer;
+    byte[] _buffer2 = null;
+    int    _bufferPos2 = 0;
+    int _pos;
+    int _windowSize = 0;
+    int _streamPos;
+    java.io.OutputStream _stream;
+    long _processedSize;
+    
+    public void Create(int windowSize) {
+        final int kMinBlockSize = 1;
+        if (windowSize < kMinBlockSize)
+            windowSize = kMinBlockSize;
+        
+        if (_buffer == null || _windowSize != windowSize)
+            _buffer = new byte[windowSize];
+        _windowSize = windowSize;
+        _pos = 0;
+        _streamPos = 0;
+    }
+    
+    public void SetStream(java.io.OutputStream stream) throws IOException {
+        ReleaseStream();
+        _stream = stream;
+    }
+    
+    public void ReleaseStream() throws IOException {
+        Flush();
+        _stream = null;
+    }
+    
+    public void SetMemStream(byte [] d) {
+        _buffer2 = d;
+        _bufferPos2 = 0;
+    }
+    
+    public void Init() {
+        Init(false);
+    }
+    public void Init(boolean solid) {
+        _processedSize = 0;
+        if (!solid) {
+            _streamPos = 0;
+            _pos = 0;
+        }
+    }
+    
+    public void Flush() throws IOException {
+        int size = _pos - _streamPos;
+        if (size == 0)
+            return;
+        if (_stream != null) _stream.write(_buffer, _streamPos, size);
+        if (_buffer2 != null) {
+            System.arraycopy(_buffer, _streamPos, _buffer2, _bufferPos2, size);
+            _bufferPos2 += size;
+        }
+        if (_pos >= _windowSize)
+            _pos = 0;
+        _streamPos = _pos;
+    }
+    
+    public void CopyBlock(int distance, int len) throws IOException {
+        int pos = _pos - distance - 1;
+        if (pos < 0)
+            pos += _windowSize;
+        for (; len != 0; len--) {
+            if (pos >= _windowSize)
+                pos = 0;
+            _buffer[_pos++] = _buffer[pos++];
+            _processedSize++;
+            if (_pos >= _windowSize)
+                Flush();
+        }
+    }
+    
+    public void PutByte(byte b) throws IOException {
+        _buffer[_pos++] = b;
+        _processedSize++;
+        if (_pos >= _windowSize)
+            Flush();
+    }
+    
+    public void WriteByte(int b)  throws IOException {
+        _buffer[_pos++] = (byte)b;
+        _processedSize++;
+        if (_pos >= _windowSize)
+            Flush();
+    }
+    
+    public byte GetByte(int distance) {
+        int pos = _pos - distance - 1;
+        if (pos < 0)
+            pos += _windowSize;
+        return _buffer[pos];
+    }
+    
+    public long GetProcessedSize() {
+        return _processedSize;
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZMA/Base.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZMA/Base.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZMA/Base.java	(revision 29679)
@@ -0,0 +1,88 @@
+// Base.java
+
+package org.j7zip.SevenZip.Compression.LZMA;
+
+public class Base
+{
+	public static final int kNumRepDistances = 4;
+	public static final int kNumStates = 12;
+	
+	public static final int StateInit()
+	{
+		return 0;
+	}
+	
+	public static final int StateUpdateChar(int index)
+	{
+		if (index < 4) 
+			return 0;
+		if (index < 10) 
+			return index - 3;
+		return index - 6;
+	}
+	
+	public static final int StateUpdateMatch(int index)
+	{
+		return (index < 7 ? 7 : 10); 
+	}
+
+	public static final int StateUpdateRep(int index)
+	{ 
+		return (index < 7 ? 8 : 11); 
+	}
+	
+	public static final int StateUpdateShortRep(int index)
+	{ 
+		return (index < 7 ? 9 : 11); 
+	}
+
+	public static final boolean StateIsCharState(int index)
+	{ 
+		return index < 7; 
+	}
+	
+	public static final int kNumPosSlotBits = 6;
+	public static final int kDicLogSizeMin = 0;
+	// public static final int kDicLogSizeMax = 28;
+	// public static final int kDistTableSizeMax = kDicLogSizeMax * 2;
+	
+	public static final int kNumLenToPosStatesBits = 2; // it's for speed optimization
+	public static final int kNumLenToPosStates = 1 << kNumLenToPosStatesBits;
+	
+	public static final int kMatchMinLen = 2;
+	
+	public static final int GetLenToPosState(int len)
+	{
+		len -= kMatchMinLen;
+		if (len < kNumLenToPosStates)
+			return len;
+		return (int)(kNumLenToPosStates - 1);
+	}
+	
+	public static final int kNumAlignBits = 4;
+	public static final int kAlignTableSize = 1 << kNumAlignBits;
+	public static final int kAlignMask = (kAlignTableSize - 1);
+	
+	public static final int kStartPosModelIndex = 4;
+	public static final int kEndPosModelIndex = 14;
+	public static final int kNumPosModels = kEndPosModelIndex - kStartPosModelIndex;
+	
+	public static final  int kNumFullDistances = 1 << (kEndPosModelIndex / 2);
+	
+	public static final  int kNumLitPosStatesBitsEncodingMax = 4;
+	public static final  int kNumLitContextBitsMax = 8;
+	
+	public static final  int kNumPosStatesBitsMax = 4;
+	public static final  int kNumPosStatesMax = (1 << kNumPosStatesBitsMax);
+	public static final  int kNumPosStatesBitsEncodingMax = 4;
+	public static final  int kNumPosStatesEncodingMax = (1 << kNumPosStatesBitsEncodingMax);
+	
+	public static final  int kNumLowLenBits = 3;
+	public static final  int kNumMidLenBits = 3;
+	public static final  int kNumHighLenBits = 8;
+	public static final  int kNumLowLenSymbols = 1 << kNumLowLenBits;
+	public static final  int kNumMidLenSymbols = 1 << kNumMidLenBits;
+	public static final  int kNumLenSymbols = kNumLowLenSymbols + kNumMidLenSymbols +
+			(1 << kNumHighLenBits);
+	public static final  int kMatchMaxLen = kMatchMinLen + kNumLenSymbols - 1;
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZMA/Decoder.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZMA/Decoder.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/LZMA/Decoder.java	(revision 29679)
@@ -0,0 +1,491 @@
+package org.j7zip.SevenZip.Compression.LZMA;
+
+
+import java.io.IOException;
+
+import org.j7zip.SevenZip.HRESULT;
+import org.j7zip.SevenZip.ICompressProgressInfo;
+import org.j7zip.SevenZip.Compression.LZ.OutWindow;
+import org.j7zip.SevenZip.Compression.RangeCoder.BitTreeDecoder;
+
+
+/*
+  public ICompressCoder,
+  public ICompressSetDecoderProperties2,
+  public ICompressGetInStreamProcessedSize,
+  #ifdef _ST_MODE
+  public ICompressSetInStream,
+  public ICompressSetOutStreamSize,
+  public ISequentialInStream,
+  #endif
+ */
+// OLD CODE public class Decoder implements SevenZip.ICompressCoder , SevenZip.ICompressSetDecoderProperties2
+public class Decoder
+        extends java.io.InputStream // _ST_MODE
+        implements org.j7zip.SevenZip.ICompressCoder , org.j7zip.SevenZip.ICompressSetDecoderProperties2 ,
+        org.j7zip.SevenZip.ICompressGetInStreamProcessedSize,
+        // #ifdef _ST_MODE
+        org.j7zip.SevenZip.ICompressSetInStream,
+        org.j7zip.SevenZip.ICompressSetOutStreamSize
+        // #endif
+        
+{
+    class LenDecoder {
+        short[] m_Choice = new short[2];
+        BitTreeDecoder[] m_LowCoder = new BitTreeDecoder[Base.kNumPosStatesMax];
+        BitTreeDecoder[] m_MidCoder = new BitTreeDecoder[Base.kNumPosStatesMax];
+        BitTreeDecoder m_HighCoder = new BitTreeDecoder(Base.kNumHighLenBits);
+        int m_NumPosStates = 0;
+        
+        public void Create(int numPosStates) {
+            for (; m_NumPosStates < numPosStates; m_NumPosStates++) {
+                m_LowCoder[m_NumPosStates] = new BitTreeDecoder(Base.kNumLowLenBits);
+                m_MidCoder[m_NumPosStates] = new BitTreeDecoder(Base.kNumMidLenBits);
+            }
+        }
+        
+        public void Init() {
+            org.j7zip.SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_Choice);
+            for (int posState = 0; posState < m_NumPosStates; posState++) {
+                m_LowCoder[posState].Init();
+                m_MidCoder[posState].Init();
+            }
+            m_HighCoder.Init();
+        }
+        
+        public int Decode(org.j7zip.SevenZip.Compression.RangeCoder.Decoder rangeDecoder, int posState) throws IOException {
+            if (rangeDecoder.DecodeBit(m_Choice, 0) == 0)
+                return m_LowCoder[posState].Decode(rangeDecoder);
+            int symbol = Base.kNumLowLenSymbols;
+            if (rangeDecoder.DecodeBit(m_Choice, 1) == 0)
+                symbol += m_MidCoder[posState].Decode(rangeDecoder);
+            else
+                symbol += Base.kNumMidLenSymbols + m_HighCoder.Decode(rangeDecoder);
+            return symbol;
+        }
+    }
+    
+    class LiteralDecoder {
+        class Decoder2 {
+            short[] m_Decoders = new short[0x300];
+            
+            public void Init() {
+                org.j7zip.SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_Decoders);
+            }
+            
+            public byte DecodeNormal(org.j7zip.SevenZip.Compression.RangeCoder.Decoder rangeDecoder) throws IOException {
+                int symbol = 1;
+                do
+                    symbol = (symbol << 1) | rangeDecoder.DecodeBit(m_Decoders, symbol);
+                while (symbol < 0x100);
+                return (byte)symbol;
+            }
+            
+            public byte DecodeWithMatchByte(org.j7zip.SevenZip.Compression.RangeCoder.Decoder rangeDecoder, byte matchByte) throws IOException {
+                int symbol = 1;
+                do
+                {
+                    int matchBit = (matchByte >> 7) & 1;
+                    matchByte <<= 1;
+                    int bit = rangeDecoder.DecodeBit(m_Decoders, ((1 + matchBit) << 8) + symbol);
+                    symbol = (symbol << 1) | bit;
+                    if (matchBit != bit) {
+                        while (symbol < 0x100)
+                            symbol = (symbol << 1) | rangeDecoder.DecodeBit(m_Decoders, symbol);
+                        break;
+                    }
+                }
+                while (symbol < 0x100);
+                return (byte)symbol;
+            }
+        }
+        
+        Decoder2[] m_Coders;
+        int m_NumPrevBits;
+        int m_NumPosBits;
+        int m_PosMask;
+        
+        public void Create(int numPosBits, int numPrevBits) {
+            if (m_Coders != null && m_NumPrevBits == numPrevBits && m_NumPosBits == numPosBits)
+                return;
+            m_NumPosBits = numPosBits;
+            m_PosMask = (1 << numPosBits) - 1;
+            m_NumPrevBits = numPrevBits;
+            int numStates = 1 << (m_NumPrevBits + m_NumPosBits);
+            m_Coders = new Decoder2[numStates];
+            for (int i = 0; i < numStates; i++)
+                m_Coders[i] = new Decoder2();
+        }
+        
+        public void Init() {
+            int numStates = 1 << (m_NumPrevBits + m_NumPosBits);
+            for (int i = 0; i < numStates; i++)
+                m_Coders[i].Init();
+        }
+        
+        Decoder2 GetDecoder(int pos, byte prevByte) {
+            return m_Coders[((pos & m_PosMask) << m_NumPrevBits) + ((prevByte & 0xFF) >>> (8 - m_NumPrevBits))];
+        }
+    }
+    
+    OutWindow m_OutWindow = new OutWindow();
+    org.j7zip.SevenZip.Compression.RangeCoder.Decoder m_RangeDecoder = new org.j7zip.SevenZip.Compression.RangeCoder.Decoder();
+    
+    short[] m_IsMatchDecoders = new short[Base.kNumStates << Base.kNumPosStatesBitsMax];
+    short[] m_IsRepDecoders = new short[Base.kNumStates];
+    short[] m_IsRepG0Decoders = new short[Base.kNumStates];
+    short[] m_IsRepG1Decoders = new short[Base.kNumStates];
+    short[] m_IsRepG2Decoders = new short[Base.kNumStates];
+    short[] m_IsRep0LongDecoders = new short[Base.kNumStates << Base.kNumPosStatesBitsMax];
+    
+    BitTreeDecoder[] m_PosSlotDecoder = new BitTreeDecoder[Base.kNumLenToPosStates];
+    short[] m_PosDecoders = new short[Base.kNumFullDistances - Base.kEndPosModelIndex];
+    
+    BitTreeDecoder m_PosAlignDecoder = new BitTreeDecoder(Base.kNumAlignBits);
+    
+    LenDecoder m_LenDecoder = new LenDecoder();
+    LenDecoder m_RepLenDecoder = new LenDecoder();
+    
+    LiteralDecoder m_LiteralDecoder = new LiteralDecoder();
+    
+    int m_DictionarySize = -1;
+    int m_DictionarySizeCheck =  -1;
+    
+    int m_posStateMask;
+    
+    public Decoder() {
+        for (int i = 0; i < Base.kNumLenToPosStates; i++)
+            m_PosSlotDecoder[i] = new BitTreeDecoder(Base.kNumPosSlotBits);
+    }
+    
+    boolean SetDictionarySize(int dictionarySize) {
+        if (dictionarySize < 0)
+            return false;
+        if (m_DictionarySize != dictionarySize) {
+            m_DictionarySize = dictionarySize;
+            m_DictionarySizeCheck = Math.max(m_DictionarySize, 1);
+            m_OutWindow.Create(Math.max(m_DictionarySizeCheck, (1 << 12)));
+            m_RangeDecoder.Create(1 << 20);
+        }
+        return true;
+    }
+    
+    boolean SetLcLpPb(int lc, int lp, int pb) {
+        if (lc > Base.kNumLitContextBitsMax || lp > 4 || pb > Base.kNumPosStatesBitsMax)
+            return false;
+        m_LiteralDecoder.Create(lp, lc);
+        int numPosStates = 1 << pb;
+        m_LenDecoder.Create(numPosStates);
+        m_RepLenDecoder.Create(numPosStates);
+        m_posStateMask = numPosStates - 1;
+        return true;
+    }
+    
+    
+    public long GetInStreamProcessedSize() {
+        throw new UnknownError("GetInStreamProcessedSize");
+        // return m_RangeDecoder.GetProcessedSize();
+    }
+    
+    public int ReleaseInStream() throws IOException {
+        m_RangeDecoder.ReleaseStream();
+        return org.j7zip.SevenZip.HRESULT.S_OK;
+    }
+    
+    public int SetInStream(java.io.InputStream inStream) { // Common.ISequentialInStream
+        m_RangeDecoder.SetStream(inStream);
+        return org.j7zip.SevenZip.HRESULT.S_OK;
+    }
+    
+    long _outSize = 0;
+    boolean _outSizeDefined = false;
+    int _remainLen; // -1 means end of stream. // -2 means need Init
+    static final int kLenIdFinished = -1;
+    static final int kLenIdNeedInit = -2;
+    int _rep0;
+    int _rep1;
+    int _rep2;
+    int _rep3;
+    int _state;
+    
+    public int SetOutStreamSize(long outSize /* const UInt64 *outSize*/ ) {
+        _outSizeDefined = (outSize != org.j7zip.SevenZip.ICompressSetOutStreamSize.INVALID_OUTSIZE);
+        if (_outSizeDefined)
+            _outSize = outSize;
+        _remainLen = kLenIdNeedInit;
+        m_OutWindow.Init();
+        return org.j7zip.SevenZip.HRESULT.S_OK;
+    }
+    
+    // #ifdef _ST_MODE
+    public int read() throws java.io.IOException {
+        throw new java.io.IOException("LZMA Decoder - read() not implemented");
+    }
+    
+    public int read(byte [] data, int off, int size) throws IOException  {
+        if (off  != 0)throw new java.io.IOException("LZMA Decoder - read(byte [] data, int off != 0, int size)) not implemented");
+        
+        long startPos = m_OutWindow.GetProcessedSize();
+        m_OutWindow.SetMemStream(data);
+        int res = CodeSpec(size);
+        if (res != HRESULT.S_OK) throw new IOException("Read - CodeSpec = " + res);
+        
+        res = Flush();
+        if (res != HRESULT.S_OK) throw new IOException("Read - Flush = " + res);
+        int ret = (int)(m_OutWindow.GetProcessedSize() - startPos);
+        if (ret == 0) ret = -1;
+        return ret;
+    }
+    
+    // #endif // _ST_MODE
+    
+    void Init() throws IOException {
+        m_OutWindow.Init(false);
+        
+        org.j7zip.SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsMatchDecoders);
+        org.j7zip.SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsRep0LongDecoders);
+        org.j7zip.SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsRepDecoders);
+        org.j7zip.SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsRepG0Decoders);
+        org.j7zip.SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsRepG1Decoders);
+        org.j7zip.SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_IsRepG2Decoders);
+        org.j7zip.SevenZip.Compression.RangeCoder.Decoder.InitBitModels(m_PosDecoders);
+        
+        _rep0 = _rep1 = _rep2 = _rep3 = 0;
+        _state = Base.StateInit();
+        
+        m_LiteralDecoder.Init();
+        int i;
+        for (i = 0; i < Base.kNumLenToPosStates; i++)
+            m_PosSlotDecoder[i].Init();
+        m_LenDecoder.Init();
+        m_RepLenDecoder.Init();
+        m_PosAlignDecoder.Init();
+    }
+    
+    public int Flush() throws IOException {
+        m_OutWindow.Flush();
+        return HRESULT.S_OK;
+    }
+    
+    void ReleaseStreams() throws IOException  {
+        m_OutWindow.ReleaseStream();
+        ReleaseInStream();
+    }
+    
+    public int CodeReal(
+            java.io.InputStream inStream, // , ISequentialInStream
+            java.io.OutputStream outStream, // ISequentialOutStream
+            long outSize,
+            ICompressProgressInfo progress // useless_progress
+            ) throws IOException {
+        
+        SetInStream(inStream);
+        m_OutWindow.SetStream(outStream);
+        SetOutStreamSize(outSize);
+        
+        for (;;) {
+            int curSize = 1 << 18;
+            int res = CodeSpec(curSize);
+            if (res != HRESULT.S_OK) {
+                return res;
+            }
+            if (_remainLen == kLenIdFinished)
+                break;
+            
+            if (progress != null) {
+                long inSize = m_RangeDecoder.GetProcessedSize();
+                long nowPos64 = m_OutWindow.GetProcessedSize();
+                res = progress.SetRatioInfo(inSize, nowPos64);
+                if (res != HRESULT.S_OK) {
+                    return res;
+                }
+            }
+            
+            if (_outSizeDefined)
+                if (m_OutWindow.GetProcessedSize() >= _outSize)
+                    break;
+        }
+        return Flush();
+    }
+    
+    public int Code(
+            java.io.InputStream inStream, // , ISequentialInStream
+            java.io.OutputStream outStream, // ISequentialOutStream
+            long outSize,
+            ICompressProgressInfo progress // useless_progress
+            ) throws IOException {
+        
+        int ret = HRESULT.S_FALSE;
+        try {
+            ret = CodeReal(inStream,outStream,outSize,progress);
+        } catch (IOException e) {
+            e.printStackTrace(); // TBD
+            this.Flush();
+            this.ReleaseStreams();
+            throw e;
+        } finally {
+            this.Flush();
+            this.ReleaseStreams();
+        }
+        return ret;
+    }
+    
+    int CodeSpec(int curSize)  throws IOException // UInt32
+    {
+        if (_outSizeDefined) {
+            long rem = _outSize - m_OutWindow.GetProcessedSize();
+            if (curSize > rem)
+                curSize = (int)rem;
+        }
+        
+        if (_remainLen == kLenIdFinished)
+            return HRESULT.S_OK;
+        if (_remainLen == kLenIdNeedInit) {
+            m_RangeDecoder.Init();
+            Init();
+            _remainLen = 0;
+        }
+        if (curSize == 0)
+            return HRESULT.S_OK;
+        
+        int rep0 = _rep0;
+        int rep1 = _rep1;
+        int rep2 = _rep2;
+        int rep3 = _rep3;
+        int state = _state;
+        byte prevByte;
+        
+        while(_remainLen > 0 && curSize > 0) {
+            prevByte = m_OutWindow.GetByte(rep0);
+            m_OutWindow.PutByte(prevByte);
+            _remainLen--;
+            curSize--;
+        }
+        long nowPos64 = m_OutWindow.GetProcessedSize();
+        if (nowPos64 == 0)
+            prevByte = 0;
+        else
+            prevByte = m_OutWindow.GetByte(0);
+        
+        while(curSize > 0) {
+            
+            if (m_RangeDecoder.bufferedStream.WasFinished())
+                return HRESULT.S_FALSE;
+            int posState = (int)nowPos64 & m_posStateMask;
+            
+            if (m_RangeDecoder.DecodeBit(m_IsMatchDecoders, (state << Base.kNumPosStatesBitsMax) + posState) == 0) {
+                LiteralDecoder.Decoder2 decoder2 = m_LiteralDecoder.GetDecoder((int)nowPos64, prevByte);
+                if (!Base.StateIsCharState(state))
+                    prevByte = decoder2.DecodeWithMatchByte(m_RangeDecoder, m_OutWindow.GetByte(rep0));
+                else
+                    prevByte = decoder2.DecodeNormal(m_RangeDecoder);
+                m_OutWindow.PutByte(prevByte);
+                state = Base.StateUpdateChar(state);
+                curSize--;
+                nowPos64++;
+            } else {
+                int len;
+                if (m_RangeDecoder.DecodeBit(m_IsRepDecoders, state) == 1) {
+                    len = 0;
+                    if (m_RangeDecoder.DecodeBit(m_IsRepG0Decoders, state) == 0) {
+                        if (m_RangeDecoder.DecodeBit(m_IsRep0LongDecoders, (state << Base.kNumPosStatesBitsMax) + posState) == 0) {
+                            state = Base.StateUpdateShortRep(state);
+                            len = 1;
+                        }
+                    } else {
+                        int distance;
+                        if (m_RangeDecoder.DecodeBit(m_IsRepG1Decoders, state) == 0)
+                            distance = rep1;
+                        else {
+                            if (m_RangeDecoder.DecodeBit(m_IsRepG2Decoders, state) == 0)
+                                distance = rep2;
+                            else {
+                                distance = rep3;
+                                rep3 = rep2;
+                            }
+                            rep2 = rep1;
+                        }
+                        rep1 = rep0;
+                        rep0 = distance;
+                    }
+                    if (len == 0) {
+                        len = m_RepLenDecoder.Decode(m_RangeDecoder, posState) + Base.kMatchMinLen;
+                        state = Base.StateUpdateRep(state);
+                    }
+                } else {
+                    rep3 = rep2;
+                    rep2 = rep1;
+                    rep1 = rep0;
+                    len = Base.kMatchMinLen + m_LenDecoder.Decode(m_RangeDecoder, posState);
+                    state = Base.StateUpdateMatch(state);
+                    int posSlot = m_PosSlotDecoder[Base.GetLenToPosState(len)].Decode(m_RangeDecoder);
+                    if (posSlot >= Base.kStartPosModelIndex) {
+                        int numDirectBits = (posSlot >> 1) - 1;
+                        rep0 = ((2 | (posSlot & 1)) << numDirectBits);
+                        if (posSlot < Base.kEndPosModelIndex)
+                            rep0 += BitTreeDecoder.ReverseDecode(m_PosDecoders,
+                                    rep0 - posSlot - 1, m_RangeDecoder, numDirectBits);
+                        else {
+                            rep0 += (m_RangeDecoder.DecodeDirectBits(
+                                    numDirectBits - Base.kNumAlignBits) << Base.kNumAlignBits);
+                            rep0 += m_PosAlignDecoder.ReverseDecode(m_RangeDecoder);
+                            if (rep0 < 0) {
+                                if (rep0 == -1)
+                                    break;
+                                return HRESULT.S_FALSE;
+                            }
+                        }
+                    } else
+                        rep0 = posSlot;
+                }
+                if (rep0 >= nowPos64 || rep0 >= m_DictionarySizeCheck) {
+                    // m_OutWindow.Flush();
+                    _remainLen = kLenIdFinished;
+                    return HRESULT.S_FALSE;
+                }
+                
+                
+                int locLen = len;
+                if (len > curSize)
+                    locLen = curSize;
+                // if (!m_OutWindow.CopyBlock(rep0, locLen))
+                //    return HRESULT.S_FALSE;
+                m_OutWindow.CopyBlock(rep0, locLen);
+                prevByte = m_OutWindow.GetByte(0);
+                curSize -= locLen;
+                nowPos64 += locLen;
+                len -= locLen;
+                if (len != 0) {
+                    _remainLen = len;
+                    break;
+                }
+            }
+        }
+        if (m_RangeDecoder.bufferedStream.WasFinished())
+            return HRESULT.S_FALSE;
+        
+        _rep0 = rep0;
+        _rep1 = rep1;
+        _rep2 = rep2;
+        _rep3 = rep3;
+        _state = state;
+        
+        return HRESULT.S_OK;
+    }
+    
+    public boolean SetDecoderProperties2(byte[] properties) {
+        if (properties.length < 5)
+            return false;
+        int val = properties[0] & 0xFF;
+        int lc = val % 9;
+        int remainder = val / 9;
+        int lp = remainder % 5;
+        int pb = remainder / 5;
+        int dictionarySize = 0;
+        for (int i = 0; i < 4; i++)
+            dictionarySize += ((int)(properties[1 + i]) & 0xFF) << (i * 8);
+        if (!SetLcLpPb(lc, lp, pb))
+            return false;
+        return SetDictionarySize(dictionarySize);
+    }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/BitDecoder.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/BitDecoder.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/BitDecoder.java	(revision 29679)
@@ -0,0 +1,36 @@
+package org.j7zip.SevenZip.Compression.RangeCoder;
+
+
+public class BitDecoder extends BitModel
+{
+    public BitDecoder(int num) {
+        super(num);
+    }
+  public int Decode(Decoder decoder)  throws java.io.IOException
+  {
+    int newBound = (decoder.Range >>> kNumBitModelTotalBits) * this.Prob;
+    if ((decoder.Code ^ 0x80000000) < (newBound ^ 0x80000000))
+    {
+      decoder.Range = newBound;
+      this.Prob += (kBitModelTotal - this.Prob) >>> numMoveBits;
+      if ((decoder.Range & kTopMask) == 0)
+      {
+        decoder.Code = (decoder.Code << 8) | decoder.bufferedStream.read();
+        decoder.Range <<= 8;
+      }
+      return 0;
+    }
+    else
+    {
+      decoder.Range -= newBound;
+      decoder.Code -= newBound;
+      this.Prob -= (this.Prob) >>> numMoveBits;
+      if ((decoder.Range & kTopMask) == 0)
+      {
+        decoder.Code = (decoder.Code << 8) | decoder.bufferedStream.read();
+        decoder.Range <<= 8;
+      }
+      return 1;
+    }
+  }
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/BitModel.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/BitModel.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/BitModel.java	(revision 29679)
@@ -0,0 +1,29 @@
+package org.j7zip.SevenZip.Compression.RangeCoder;
+
+
+public class BitModel
+{
+
+    public static final int kTopMask = ~((1 << 24) - 1);
+	public static final int kNumBitModelTotalBits  = 11;
+	public static final int kBitModelTotal = (1 << kNumBitModelTotalBits);
+
+	int numMoveBits;
+
+	int Prob;
+
+	public BitModel(int num)  {
+		numMoveBits = num;
+	}
+	/*
+  public void UpdateModel(UInt32 symbol)
+  {
+    if (symbol == 0)
+      Prob += (kBitModelTotal - Prob) >> numMoveBits;
+    else
+      Prob -= (Prob) >> numMoveBits;
+  }
+  	*/
+  public void Init() { Prob = kBitModelTotal / 2; }
+
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/BitTreeDecoder.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/BitTreeDecoder.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/BitTreeDecoder.java	(revision 29679)
@@ -0,0 +1,55 @@
+package org.j7zip.SevenZip.Compression.RangeCoder;
+
+public class BitTreeDecoder
+{
+	short[] Models;
+	int NumBitLevels;
+	
+	public BitTreeDecoder(int numBitLevels)
+	{
+		NumBitLevels = numBitLevels;
+		Models = new short[1 << numBitLevels];
+	}
+	
+	public void Init()
+	{
+		Decoder.InitBitModels(Models);
+	}
+	
+	public int Decode(Decoder rangeDecoder) throws java.io.IOException
+	{
+		int m = 1;
+		for (int bitIndex = NumBitLevels; bitIndex != 0; bitIndex--)
+			m = (m << 1) + rangeDecoder.DecodeBit(Models, m);
+		return m - (1 << NumBitLevels);
+	}
+	
+	public int ReverseDecode(Decoder rangeDecoder) throws java.io.IOException
+	{
+		int m = 1;
+		int symbol = 0;
+		for (int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++)
+		{
+			int bit = rangeDecoder.DecodeBit(Models, m);
+			m <<= 1;
+			m += bit;
+			symbol |= (bit << bitIndex);
+		}
+		return symbol;
+	}
+	
+	public static int ReverseDecode(short[] Models, int startIndex,
+			Decoder rangeDecoder, int NumBitLevels) throws java.io.IOException
+	{
+		int m = 1;
+		int symbol = 0;
+		for (int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++)
+		{
+			int bit = rangeDecoder.DecodeBit(Models, startIndex + m);
+			m <<= 1;
+			m += bit;
+			symbol |= (bit << bitIndex);
+		}
+		return symbol;
+	}
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/Decoder.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/Decoder.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/Compression/RangeCoder/Decoder.java	(revision 29679)
@@ -0,0 +1,108 @@
+package org.j7zip.SevenZip.Compression.RangeCoder;
+import java.io.IOException;
+
+public class Decoder
+{
+	static final int kTopMask = ~((1 << 24) - 1);
+	
+	static final int kNumBitModelTotalBits = 11;
+	static final int kBitModelTotal = (1 << kNumBitModelTotalBits);
+	static final int kNumMoveBits = 5;
+	
+	int Range;
+	int Code;
+        
+        // boolean _wasFinished;
+        // long _processedSize;
+        
+        // public boolean WasFinished() { return _wasFinished; }
+
+	// public java.io.InputStream Stream;
+        
+        public org.j7zip.SevenZip.Common.InBuffer bufferedStream = new org.j7zip.SevenZip.Common.InBuffer();
+        
+        int read() throws IOException {
+            return bufferedStream.read();
+        }
+        
+        public void Create(int bufferSize) { bufferedStream.Create(bufferSize); }
+        
+        public long GetProcessedSize() {
+            return bufferedStream.GetProcessedSize();
+        }
+	
+	public final void SetStream(java.io.InputStream stream)
+	{ 
+		bufferedStream.SetStream(stream);  
+	}
+	
+	public final void ReleaseStream() throws IOException
+	{ 
+		bufferedStream.ReleaseStream();
+	}
+	
+	public final void Init() throws IOException
+	{
+                bufferedStream.Init();
+		Code = 0;
+		Range = -1;
+		for (int i = 0; i < 5; i++) {
+                    Code = (Code << 8) | this.read();
+                }
+			
+	}
+	
+	public final int DecodeDirectBits(int numTotalBits) throws IOException
+	{
+		int result = 0;
+		for (int i = numTotalBits; i != 0; i--)
+		{
+			Range >>>= 1;
+			int t = ((Code - Range) >>> 31);
+			Code -= Range & (t - 1);
+			result = (result << 1) | (1 - t);
+			
+			if ((Range & kTopMask) == 0)
+			{
+				Code = (Code << 8) | this.read();
+				Range <<= 8;
+			}
+		}
+		return result;
+	}
+	
+	public int DecodeBit(short []probs, int index) throws IOException
+	{
+		int prob = probs[index];
+		int newBound = (Range >>> kNumBitModelTotalBits) * prob;
+		if ((Code ^ 0x80000000) < (newBound ^ 0x80000000))
+		{
+			Range = newBound;
+			probs[index] = (short)(prob + ((kBitModelTotal - prob) >>> kNumMoveBits));
+			if ((Range & kTopMask) == 0)
+			{
+				Code = (Code << 8) | this.read();
+				Range <<= 8;
+			}
+			return 0;
+		}
+		else
+		{
+			Range -= newBound;
+			Code -= newBound;
+			probs[index] = (short)(prob - ((prob) >>> kNumMoveBits));
+			if ((Range & kTopMask) == 0)
+			{
+				Code = (Code << 8) | this.read();
+				Range <<= 8;
+			}
+			return 1;
+		}
+	}
+	
+	public static void InitBitModels(short []probs)
+	{
+		for (int i = 0; i < probs.length; i++)
+			probs[i] = (kBitModelTotal >>> 1);
+	}
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/HRESULT.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/HRESULT.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/HRESULT.java	(revision 29679)
@@ -0,0 +1,11 @@
+package org.j7zip.SevenZip;
+
+public class HRESULT {
+    public static final int S_OK = 0;
+    public static final int S_FALSE = 1;
+    
+    public static final int E_NOTIMPL    = 0x80004001;
+    public static final int E_FAIL       = 0x80004005;
+    public static final int E_INVALIDARG = 0x80070057;
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICodeProgress.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICodeProgress.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICodeProgress.java	(revision 29679)
@@ -0,0 +1,6 @@
+package org.j7zip.SevenZip;
+
+public interface ICodeProgress
+{
+	public void SetProgress(long inSize, long outSize);
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressCoder.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressCoder.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressCoder.java	(revision 29679)
@@ -0,0 +1,9 @@
+package org.j7zip.SevenZip;
+
+public interface ICompressCoder {
+    int Code(
+            java.io.InputStream inStream, // , ISequentialInStream
+            java.io.OutputStream outStream, // ISequentialOutStream
+            long outSize, ICompressProgressInfo progress) throws java.io.IOException ;
+    
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressCoder2.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressCoder2.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressCoder2.java	(revision 29679)
@@ -0,0 +1,16 @@
+package org.j7zip.SevenZip;
+
+import org.j7zip.Common.RecordVector;
+
+public interface ICompressCoder2 {
+    public int Code(
+            RecordVector<java.io.InputStream>  inStreams,
+            Object useless1, // const UInt64 ** /* inSizes */,
+            int numInStreams,
+            RecordVector<java.io.OutputStream> outStreams,
+            Object useless2, // const UInt64 ** /* outSizes */,
+            int numOutStreams,
+            ICompressProgressInfo progress) throws java.io.IOException;
+    
+    public void close() throws java.io.IOException ; // destructor
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressFilter.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressFilter.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressFilter.java	(revision 29679)
@@ -0,0 +1,12 @@
+package org.j7zip.SevenZip;
+
+public interface ICompressFilter {
+  int Init();
+  int Filter(byte [] data, int size);
+  // Filter return outSize (UInt32)
+  // if (outSize <= size): Filter have converted outSize bytes
+  // if (outSize > size): Filter have not converted anything.
+  //      and it needs at least outSize bytes to convert one block 
+  //      (it's for crypto block algorithms).
+
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressGetInStreamProcessedSize.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressGetInStreamProcessedSize.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressGetInStreamProcessedSize.java	(revision 29679)
@@ -0,0 +1,6 @@
+package org.j7zip.SevenZip;
+
+public interface ICompressGetInStreamProcessedSize {
+    public long GetInStreamProcessedSize();
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressProgressInfo.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressProgressInfo.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressProgressInfo.java	(revision 29679)
@@ -0,0 +1,6 @@
+package org.j7zip.SevenZip;
+
+public interface ICompressProgressInfo {
+    public static final long INVALID = -1;
+    int SetRatioInfo(long inSize, long outSize);
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetDecoderProperties2.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetDecoderProperties2.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetDecoderProperties2.java	(revision 29679)
@@ -0,0 +1,5 @@
+package org.j7zip.SevenZip;
+
+public interface ICompressSetDecoderProperties2 {
+    public boolean SetDecoderProperties2(byte[] properties);
+}
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetInStream.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetInStream.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetInStream.java	(revision 29679)
@@ -0,0 +1,7 @@
+package org.j7zip.SevenZip;
+
+public interface ICompressSetInStream {
+    public int SetInStream(java.io.InputStream inStream);
+    public int ReleaseInStream() throws java.io.IOException ;
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetOutStream.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetOutStream.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetOutStream.java	(revision 29679)
@@ -0,0 +1,7 @@
+package org.j7zip.SevenZip;
+
+public interface ICompressSetOutStream {
+    public int SetOutStream(java.io.OutputStream inStream);
+    public int ReleaseOutStream() throws java.io.IOException;
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetOutStreamSize.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetOutStreamSize.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/ICompressSetOutStreamSize.java	(revision 29679)
@@ -0,0 +1,7 @@
+package org.j7zip.SevenZip;
+
+public interface ICompressSetOutStreamSize {
+    public static final int INVALID_OUTSIZE=-1;
+    public int SetOutStreamSize(long outSize);
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/IInStream.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/IInStream.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/IInStream.java	(revision 29679)
@@ -0,0 +1,10 @@
+package org.j7zip.SevenZip;
+
+public abstract class IInStream extends java.io.InputStream
+{
+  static public final int STREAM_SEEK_SET	= 0;
+  static public final int STREAM_SEEK_CUR	= 1;
+  // static public final int STREAM_SEEK_END	= 2;
+  public abstract long Seek(long offset, int seekOrigin)  throws java.io.IOException ;
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/IProgress.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/IProgress.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/IProgress.java	(revision 29679)
@@ -0,0 +1,7 @@
+package org.j7zip.SevenZip;
+
+public interface IProgress {
+    public int SetTotal(long total);
+    public int SetCompleted(long completeValue);
+}
+
Index: /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/MyRandomAccessFile.java
===================================================================
--- /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/MyRandomAccessFile.java	(revision 29679)
+++ /applications/editors/josm/plugins/opendata/includes/org/j7zip/SevenZip/MyRandomAccessFile.java	(revision 29679)
@@ -0,0 +1,37 @@
+package org.j7zip.SevenZip;
+
+public class MyRandomAccessFile extends org.j7zip.SevenZip.IInStream  {
+    
+    java.io.RandomAccessFile _file;
+    
+    public MyRandomAccessFile(String filename,String mode)  throws java.io.IOException {
+        _file  = new java.io.RandomAccessFile(filename,mode);
+    }
+    
+    public long Seek(long offset, int seekOrigin)  throws java.io.IOException {
+        if (seekOrigin == STREAM_SEEK_SET) {
+            _file.seek(offset);
+        }
+        else if (seekOrigin == STREAM_SEEK_CUR) {
+            _file.seek(offset + _file.getFilePointer());
+        }
+        return _file.getFilePointer();
+    }
+    
+    public int read() throws java.io.IOException {
+        return _file.read();
+    }
+ 
+    public int read(byte [] data, int off, int size) throws java.io.IOException {
+        return _file.read(data,off,size);
+    }
+        
+    public int read(byte [] data, int size) throws java.io.IOException {
+        return _file.read(data,0,size);
+    }
+    
+    public void close() throws java.io.IOException {
+        _file.close();
+        _file = null;
+    }   
+}
Index: /applications/editors/josm/plugins/opendata/modules/fr.datagouvfr/src/org/openstreetmap/josm/plugins/opendata/modules/fr/datagouvfr/datasets/hydrologie/EauxDeSurfaceHandler.java
===================================================================
--- /applications/editors/josm/plugins/opendata/modules/fr.datagouvfr/src/org/openstreetmap/josm/plugins/opendata/modules/fr/datagouvfr/datasets/hydrologie/EauxDeSurfaceHandler.java	(revision 29678)
+++ /applications/editors/josm/plugins/opendata/modules/fr.datagouvfr/src/org/openstreetmap/josm/plugins/opendata/modules/fr/datagouvfr/datasets/hydrologie/EauxDeSurfaceHandler.java	(revision 29679)
@@ -29,5 +29,5 @@
 
 import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.plugins.opendata.core.io.archive.DefaultZipHandler;
+import org.openstreetmap.josm.plugins.opendata.core.io.archive.DefaultArchiveHandler;
 import org.openstreetmap.josm.plugins.opendata.modules.fr.datagouvfr.datasets.DataGouvDataSetHandler;
 import org.openstreetmap.josm.tools.Pair;
@@ -66,5 +66,5 @@
 	public EauxDeSurfaceHandler() {
 		setName("Eaux de surface");
-		setZipHandler(new InternalZipHandler());
+		setArchiveHandler(new InternalZipHandler());
 	}
 	
@@ -126,5 +126,5 @@
 	}
 	
-	private class InternalZipHandler extends DefaultZipHandler {
+	private class InternalZipHandler extends DefaultArchiveHandler {
 		@Override
 		public void notifyTempFileWritten(File file) {
Index: /applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ReseauTisseoHandler.java
===================================================================
--- /applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ReseauTisseoHandler.java	(revision 29678)
+++ /applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ReseauTisseoHandler.java	(revision 29679)
@@ -34,5 +34,5 @@
         setName("Réseau Tisséo (Métro, Bus, Tram)");
         setCategory(CAT_TRANSPORT);
-        getZipHandler().setSkipXsdValidation(true);
+        getArchiveHandler().setSkipXsdValidation(true);
     }
 
