Full Code of edmund-wagner/junrar for AI

master d1079dfb557a cached
98 files
344.3 KB
105.6k tokens
803 symbols
1 requests
Download .txt
Showing preview only (376K chars total). Download the full file or copy to clipboard to get everything.
Repository: edmund-wagner/junrar
Branch: master
Commit: d1079dfb557a
Files: 98
Total size: 344.3 KB

Directory structure:
gitextract_8hmv49fy/

├── .gitignore
├── license.txt
├── testutil/
│   ├── .gitignore
│   ├── pom.xml
│   └── src/
│       └── main/
│           ├── java/
│           │   └── com/
│           │       └── github/
│           │           └── junrar/
│           │               └── testutil/
│           │                   ├── ExtractArchive.java
│           │                   └── JUnRarTestUtil.java
│           └── resources/
│               └── META-INF/
│                   └── MANIFEST.MF
└── unrar/
    ├── .gitignore
    ├── generate-testdata.sh
    ├── pom.xml
    ├── readme.md
    └── src/
        └── main/
            └── java/
                └── com/
                    └── github/
                        └── junrar/
                            ├── Archive.java
                            ├── MVTest.java
                            ├── UnrarCallback.java
                            ├── Volume.java
                            ├── VolumeManager.java
                            ├── crc/
                            │   └── RarCRC.java
                            ├── crypt/
                            │   └── Rijndael.java
                            ├── exception/
                            │   └── RarException.java
                            ├── impl/
                            │   ├── FileVolume.java
                            │   └── FileVolumeManager.java
                            ├── io/
                            │   ├── IReadOnlyAccess.java
                            │   ├── InputStreamReadOnlyAccessFile.java
                            │   ├── RandomAccessStream.java
                            │   ├── Raw.java
                            │   ├── ReadOnlyAccessByteArray.java
                            │   ├── ReadOnlyAccessFile.java
                            │   └── ReadOnlyAccessInputStream.java
                            ├── rarfile/
                            │   ├── AVHeader.java
                            │   ├── BaseBlock.java
                            │   ├── BlockHeader.java
                            │   ├── CommentHeader.java
                            │   ├── EAHeader.java
                            │   ├── EndArcHeader.java
                            │   ├── FileHeader.java
                            │   ├── FileNameDecoder.java
                            │   ├── HostSystem.java
                            │   ├── MacInfoHeader.java
                            │   ├── MainHeader.java
                            │   ├── MarkHeader.java
                            │   ├── NewSubHeaderType.java
                            │   ├── ProtectHeader.java
                            │   ├── SignHeader.java
                            │   ├── SubBlockHeader.java
                            │   ├── SubBlockHeaderType.java
                            │   ├── UnixOwnersHeader.java
                            │   └── UnrarHeadertype.java
                            ├── unpack/
                            │   ├── ComprDataIO.java
                            │   ├── Unpack.java
                            │   ├── Unpack15.java
                            │   ├── Unpack20.java
                            │   ├── UnpackFilter.java
                            │   ├── decode/
                            │   │   ├── AudioVariables.java
                            │   │   ├── BitDecode.java
                            │   │   ├── CodeType.java
                            │   │   ├── Compress.java
                            │   │   ├── Decode.java
                            │   │   ├── DistDecode.java
                            │   │   ├── FilterType.java
                            │   │   ├── LitDecode.java
                            │   │   ├── LowDistDecode.java
                            │   │   ├── MultDecode.java
                            │   │   └── RepDecode.java
                            │   ├── ppm/
                            │   │   ├── AnalyzeHeapDump.java
                            │   │   ├── BlockTypes.java
                            │   │   ├── FreqData.java
                            │   │   ├── ModelPPM.java
                            │   │   ├── PPMContext.java
                            │   │   ├── Pointer.java
                            │   │   ├── RangeCoder.java
                            │   │   ├── RarMemBlock.java
                            │   │   ├── RarNode.java
                            │   │   ├── SEE2Context.java
                            │   │   ├── State.java
                            │   │   ├── StateRef.java
                            │   │   └── SubAllocator.java
                            │   └── vm/
                            │       ├── BitInput.java
                            │       ├── RarVM.java
                            │       ├── VMCmdFlags.java
                            │       ├── VMCommands.java
                            │       ├── VMFlags.java
                            │       ├── VMOpType.java
                            │       ├── VMPreparedCommand.java
                            │       ├── VMPreparedOperand.java
                            │       ├── VMPreparedProgram.java
                            │       ├── VMStandardFilterSignature.java
                            │       └── VMStandardFilters.java
                            ├── unsigned/
                            │   ├── UnsignedByte.java
                            │   ├── UnsignedInteger.java
                            │   ├── UnsignedLong.java
                            │   └── UnsignedShort.java
                            ├── util/
                            │   └── VolumeHelper.java
                            └── vfs2/
                                └── provider/
                                    └── rar/
                                        ├── RARFileObject.java
                                        ├── RARFileProvider.java
                                        ├── RARFileSystem.java
                                        ├── RandomAccessContentAccess.java
                                        ├── VFSVolume.java
                                        └── VFSVolumeManager.java

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
.classpath
.project
.settings/
target/


================================================
FILE: license.txt
================================================
 ******    *****   ******   UnRAR - free utility for RAR archives
 **   **  **   **  **   **  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ******   *******  ******    License for use and distribution of
 **   **  **   **  **   **   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 **   **  **   **  **   **         FREE portable version
                                   ~~~~~~~~~~~~~~~~~~~~~

      The source code of UnRAR utility is freeware. This means:

   1. All copyrights to RAR and the utility UnRAR are exclusively
      owned by the author - Alexander Roshal.

   2. The UnRAR sources may be used in any software to handle RAR
      archives without limitations free of charge, but cannot be used
      to re-create the RAR compression algorithm, which is proprietary.
      Distribution of modified UnRAR sources in separate form or as a
      part of other software is permitted, provided that it is clearly
      stated in the documentation and source comments that the code may
      not be used to develop a RAR (WinRAR) compatible archiver.

   3. The UnRAR utility may be freely distributed. It is allowed
      to distribute UnRAR inside of other software packages.

   4. THE RAR ARCHIVER AND THE UnRAR UTILITY ARE DISTRIBUTED "AS IS".
      NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED.  YOU USE AT 
      YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS, 
      DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
      OR MISUSING THIS SOFTWARE.

   5. Installing and using the UnRAR utility signifies acceptance of
      these terms and conditions of the license.

   6. If you don't agree with terms of the license you must remove
      UnRAR files from your storage devices and cease to use the
      utility.

      Thank you for your interest in RAR and UnRAR.


                                            Alexander L. Roshal

================================================
FILE: testutil/.gitignore
================================================
.classpath
.project
bin/
.checkstyle


================================================
FILE: testutil/pom.xml
================================================
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.github.junrar</groupId>
	<artifactId>junrar-testutil</artifactId>
	<packaging>jar</packaging>
	<version>0.1</version>
	<name>java-unrar-testutil</name>
	<url>http://maven.apache.org</url>
	<developers>
		<developer>
			<id>edmund_wagner</id>
			<name>Edmund Wagner</name>
			<email>edmund_wagner@users.sourceforge.net</email>
			<roles>
				<role></role>
			</roles>
		</developer>
	</developers>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>2.2</version>
				<configuration>
					<archive>
						<manifest>
							<mainClass>
								de.innosystec.unrar.testutil.JUnRarTestUtil
							</mainClass>
							<packageName>
								de.innosystec.unrar.testutil
							</packageName>
							<addClasspath>true</addClasspath>
							<addExtensions />
							<classpathPrefix />
						</manifest>
						<manifestEntries>
							<mode>development</mode>
							<url>${pom.url}</url>
						</manifestEntries>
						<manifestFile>
							src/main/resources/META-INF/MANIFEST.MF
						</manifestFile>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.github.junrar</groupId>
			<artifactId>junrar</artifactId>
			<version>0.6-SNAPSHOT</version>
		</dependency>
	</dependencies>
</project>


================================================
FILE: testutil/src/main/java/com/github/junrar/testutil/ExtractArchive.java
================================================
package com.github.junrar.testutil;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.github.junrar.Archive;
import com.github.junrar.exception.RarException;
import com.github.junrar.rarfile.FileHeader;

/**
 * extract an archive to the given location
 * 
 * @author edmund wagner
 * 
 */
public class ExtractArchive {

    private static Log logger = LogFactory.getLog(ExtractArchive.class
	    .getName());

    public static void extractArchive(String archive, String destination) {
	if (archive == null || destination == null) {
	    throw new RuntimeException("archive and destination must me set");
	}
	File arch = new File(archive);
	if (!arch.exists()) {
	    throw new RuntimeException("the archive does not exit: " + archive);
	}
	File dest = new File(destination);
	if (!dest.exists() || !dest.isDirectory()) {
	    throw new RuntimeException(
		    "the destination must exist and point to a directory: "
			    + destination);
	}
	extractArchive(arch, dest);
    }

    public static void main(String[] args) {
	if (args.length == 2) {
	    extractArchive(args[0], args[1]);
	} else {
	    System.out
		    .println("usage: java -jar extractArchive.jar <thearchive> <the destination directory>");
	}
    }

    public static void extractArchive(File archive, File destination) {
	Archive arch = null;
	try {
	    arch = new Archive(archive);
	} catch (RarException e) {
	    logger.error(e);
	} catch (IOException e1) {
	    logger.error(e1);
	}
	if (arch != null) {
	    if (arch.isEncrypted()) {
		logger.warn("archive is encrypted cannot extreact");
		return;
	    }
	    FileHeader fh = null;
	    while (true) {
		fh = arch.nextFileHeader();
		if (fh == null) {
		    break;
		}
		if (fh.isEncrypted()) {
		    logger.warn("file is encrypted cannot extract: "
			    + fh.getFileNameString());
		    continue;
		}
		logger.info("extracting: " + fh.getFileNameString());
		try {
		    if (fh.isDirectory()) {
			createDirectory(fh, destination);
		    } else {
			File f = createFile(fh, destination);
			OutputStream stream = new FileOutputStream(f);
			arch.extractFile(fh, stream);
			stream.close();
		    }
		} catch (IOException e) {
		    logger.error("error extracting the file", e);
		} catch (RarException e) {
		    logger.error("error extraction the file", e);
		}
	    }
	}
    }

    private static File createFile(FileHeader fh, File destination) {
	File f = null;
	String name = null;
	if (fh.isFileHeader() && fh.isUnicode()) {
	    name = fh.getFileNameW();
	} else {
	    name = fh.getFileNameString();
	}
	f = new File(destination, name);
	if (!f.exists()) {
	    try {
		f = makeFile(destination, name);
	    } catch (IOException e) {
		logger.error("error creating the new file: " + f.getName(), e);
	    }
	}
	return f;
    }

    private static File makeFile(File destination, String name)
	    throws IOException {
	String[] dirs = name.split("\\\\");
	if (dirs == null) {
	    return null;
	}
	String path = "";
	int size = dirs.length;
	if (size == 1) {
	    return new File(destination, name);
	} else if (size > 1) {
	    for (int i = 0; i < dirs.length - 1; i++) {
		path = path + File.separator + dirs[i];
		new File(destination, path).mkdir();
	    }
	    path = path + File.separator + dirs[dirs.length - 1];
	    File f = new File(destination, path);
	    f.createNewFile();
	    return f;
	} else {
	    return null;
	}
    }

    private static void createDirectory(FileHeader fh, File destination) {
	File f = null;
	if (fh.isDirectory() && fh.isUnicode()) {
	    f = new File(destination, fh.getFileNameW());
	    if (!f.exists()) {
		makeDirectory(destination, fh.getFileNameW());
	    }
	} else if (fh.isDirectory() && !fh.isUnicode()) {
	    f = new File(destination, fh.getFileNameString());
	    if (!f.exists()) {
		makeDirectory(destination, fh.getFileNameString());
	    }
	}
    }

    private static void makeDirectory(File destination, String fileName) {
	String[] dirs = fileName.split("\\\\");
	if (dirs == null) {
	    return;
	}
	String path = "";
	for (String dir : dirs) {
	    path = path + File.separator + dir;
	    new File(destination, path).mkdir();
	}

    }
}


================================================
FILE: testutil/src/main/java/com/github/junrar/testutil/JUnRarTestUtil.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: EW
 * Creation date: 26.09.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.testutil;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.github.junrar.Archive;
import com.github.junrar.exception.RarException;
import com.github.junrar.exception.RarException.RarExceptionType;
import com.github.junrar.io.ReadOnlyAccessFile;
import com.github.junrar.rarfile.FileHeader;

/**
 * DOCUMENT ME
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class JUnRarTestUtil
{
	private static Log logger = LogFactory.getLog(JUnRarTestUtil.class.getName());
	/**
	 * @param args
	 */
	private static List<String> successfulFiles = new ArrayList<String>();
	
	private static List<String> errorFiles = new ArrayList<String>();
	
	private static List<String> unsupportedFiles = new ArrayList<String>();
	
	public static void main(String[] args)
	{
		if(args.length!=1){
			System.out.println("JUnRar TestUtil\n usage: java -jar unrar-test.jar <directory with test files>");
			return;
		}else{
			File file = new File(args[0]);
			if(file.exists()){
				if(file.isDirectory()){
					recurseDirectory(file);
				}else{
					testFile(file);
				}
			}
		}
		printSummary();

	}

	private static void printSummary()
	{
		System.out.println("\n\n\nSuccessfully tested archives:\n");
		for(String sf:successfulFiles){
			System.out.println(sf);
		}
		System.out.println("");
		System.out.println("Unsupported archives:\n");
		for(String uf: unsupportedFiles){
			System.out.println(uf);
		}
		System.out.println("");
		System.out.println("Failed archives:");
		for(String ff: errorFiles){
			System.out.println(ff);
		}
		System.out.println("");
		System.out.println("\n\n\nSummary\n");
		System.out.println("tested:\t\t"+(successfulFiles.size()+unsupportedFiles.size()+errorFiles.size()));
		System.out.println("successful:\t"+successfulFiles.size());
		System.out.println("unsupported:\t"+unsupportedFiles.size());
		System.out.println("failed:\t\t"+errorFiles.size());
	}

	private static void testFile(File file)
	{
		if(file==null || !file.exists()){
			logger.error("error file " +file + " does not exist");
			return;
		}
		logger.info(">>>>>> testing archive: "+file);
		String s = file.toString();
		s = s.substring(s.length()-3);
		if(s.equalsIgnoreCase("rar")){
			System.out.println(file.toString());
			ReadOnlyAccessFile readFile = null;
			try {
//				readFile = new ReadOnlyAccessFile(file);
				Archive arc = null;
				try {
					arc = new Archive(file);
				} catch (RarException e) {
					logger.error("archive consturctor error",e);
					errorFiles.add(file.toString());
					return;
				}
				if(arc != null){
					if(arc.isEncrypted()){
						logger.warn("archive is encrypted cannot extreact");
						unsupportedFiles.add(file.toString());
						return;
					}
					List<FileHeader> files = arc.getFileHeaders();
					for(FileHeader fh : files)
					{
						if(fh.isEncrypted()){
							logger.warn("file is encrypted cannot extract: "+fh.getFileNameString());
							unsupportedFiles.add(file.toString());
							return;
						}
						logger.info("extracting file: "+fh.getFileNameString());
						if(fh.isFileHeader() && fh.isUnicode()){
							logger.info("unicode name: "+fh.getFileNameW());
						}
						logger.info("start: "+new Date());
						
						ByteArrayOutputStream os = new ByteArrayOutputStream();
						
						
						try {
							arc.extractFile(fh, os);
						} catch (RarException e) {
							if(e.getType().equals(RarExceptionType.notImplementedYet)){
								logger.error("error extracting unsupported file: "+fh.getFileNameString(),e);
								unsupportedFiles.add(file.toString());
								return;
							}
							logger.error("error extracting file: "+fh.getFileNameString(),e);
							errorFiles.add(file.toString());
							return;
						}finally{
							os.close();
						}
						
						logger.info("end: "+new Date());
					}
				}
				logger.info("successfully tested archive: "+file);
				successfulFiles.add(file.toString());
			} catch (Exception e) {
				logger.error("file: "+file+ " extraction error - does the file exist?"+e );
				errorFiles.add(file.toString());
			} finally{
				if(readFile!=null){
					try {
						readFile.close();
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
			}
			
		}
	}
	
	private static void recurseDirectory(File file)
	{
		if(file==null||!file.exists()){
			return;
		}
		if(file.isDirectory()){
			File[] files = file.listFiles();
			if(files == null){
				return;
			}
			for(File f: files){
				recurseDirectory(f);
				f = null;
			}
		}else{
			testFile(file);
			file=null;
		}
		
	}

	

}


================================================
FILE: testutil/src/main/resources/META-INF/MANIFEST.MF
================================================


================================================
FILE: unrar/.gitignore
================================================
.classpath
.project



================================================
FILE: unrar/generate-testdata.sh
================================================

mode=$1
adstepping=$2
t1stepping=$3
t2stepping=$4
indir=$5
outdir=$6
par1=1
par2=1
path=$PWD


function start {
case "$1" in
	a|d)
		.
			while [ $par1 -le 31 ]
			do
			rar a -ep1 -mc$par1$1+ $path/$outdir/$i/$i-mc$par1$1+.rar $path/$indir/$i
			let par1+=adstepping
			done
		par1=1
	;;
	t)
			let par1=2
			while [ $par1 -le 63 ]
			do
				while [ $par2 -le 128 ]
				do
					rar a -ep1 -mc$par1:$par2$1+ $path/$outdir/$i/$i-mc$par1.$par2$1+.rar $path/$indir/$i
					let par2+=$t2stepping
				done
			let par1+=$t1stepping
			let par2=1
			done
		par1=1
	;;
	c|e|i)

			rar a -ep1 -mc$1+ $path/$outdir/$i/$i-mc$1+.rar $path/$indir/$i
			par1=1
	;;
	n)

			rar a -ep1 -mca- -mcd- -mct- -mcc- -mce- -mci-  $path/$outdir/$i/$i-n.rar $path/$indir/$i
	;;
	esac
}


if [ "$mode" != "" ] && [ "$adstepping" != "" ]  &&[ "$t1stepping" != "" ] && [ "$t2stepping" != "" ] && [ "$indir" != "" ] && [ "$outdir" != "" ];
then
	# create output dir
	mkdir -m 0777 $outdir

	cd $indir

	for i in $(ls *)
	do
		mkdir -m 0777 $path/$outdir/$i
		if [ "$1" == "all" ];then
			start a
			start d
			start c
			start e
			start i
			start t
			start n
		else
			start "$mode"
		fi
	done
else
	
	echo "usage: ./generate-testdata.sh [ a | d | c  | e | i | t | n | all ] [ adstepping ] [ t1stepping]  [ t2stepping]  [ indir ] [ outdir ]"
	echo .......................................
	exit 0
fi





================================================
FILE: unrar/pom.xml
================================================
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.github.beothorn</groupId>
	<artifactId>junrar</artifactId>
	<packaging>jar</packaging>
	<version>0.7-SNAPSHOT</version>
	<name>Java UnRar</name>
	<description>rar decompression library in plain java</description>
	<url>https://github.com/edmund-wagner/junrar</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>1.6</maven.compiler.source>
		<maven.compiler.target>1.6</maven.compiler.target>
	</properties>

	<licenses>
		<license>
			<name>UnRar License</name>
			<url>https://raw.github.com/edmund-wagner/junrar/master/license.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<scm>
		<connection>scm:git:git@github.com:edmund-wagner/junrar.git</connection>
		<developerConnection>scm:git:git@github.com:edmund-wagner/junrar.git</developerConnection>
		<url>git@github.com:edmund-wagner/junrar.git</url>
	</scm>

	<developers>
		<developer>
			<id>edmund_wagner</id>
			<name>Edmund Wagner</name>
		</developer>
	</developers>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<type>jar</type>
			<scope>test</scope>
			<optional>false</optional>
		</dependency>
		<dependency>
			<groupId>commons-logging</groupId>
			<artifactId>commons-logging-api</artifactId>
			<version>1.1</version>
			<type>jar</type>
			<optional>false</optional>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-vfs2</artifactId>
			<version>2.0</version>
			<optional>true</optional>
		</dependency>
	</dependencies>
	
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<version>2.2.1</version>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>sign</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-compiler-plugin</artifactId>
						<version>2.3.2</version>
						<configuration>
							<source>${maven.compiler.source}</source>
							<target>${maven.compiler.source}</target>
							<encoding>${project.build.sourceEncoding}</encoding>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
	
	<parent>
		<groupId>org.sonatype.oss</groupId>
		<artifactId>oss-parent</artifactId>
		<version>7</version>
	</parent>
</project>


================================================
FILE: unrar/readme.md
================================================
unrar
=====

Adds support to read a rar from a given InputStream.

Additional dependencies
-----------------------
* ij: http://rsbweb.nih.gov/ij/

================================================
FILE: unrar/src/main/java/com/github/junrar/Archive.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 22.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 *
 * the unrar licence applies to all junrar source and binary distributions
 * you are not allowed to use this source to re-create the RAR compression
 * algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;"
 */
package com.github.junrar;

import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.github.junrar.exception.RarException;
import com.github.junrar.exception.RarException.RarExceptionType;
import com.github.junrar.impl.FileVolumeManager;
import com.github.junrar.io.IReadOnlyAccess;
import com.github.junrar.rarfile.AVHeader;
import com.github.junrar.rarfile.BaseBlock;
import com.github.junrar.rarfile.BlockHeader;
import com.github.junrar.rarfile.CommentHeader;
import com.github.junrar.rarfile.EAHeader;
import com.github.junrar.rarfile.EndArcHeader;
import com.github.junrar.rarfile.FileHeader;
import com.github.junrar.rarfile.MacInfoHeader;
import com.github.junrar.rarfile.MainHeader;
import com.github.junrar.rarfile.MarkHeader;
import com.github.junrar.rarfile.ProtectHeader;
import com.github.junrar.rarfile.SignHeader;
import com.github.junrar.rarfile.SubBlockHeader;
import com.github.junrar.rarfile.UnixOwnersHeader;
import com.github.junrar.rarfile.UnrarHeadertype;
import com.github.junrar.unpack.ComprDataIO;
import com.github.junrar.unpack.Unpack;


/**
 * The Main Rar Class; represents a rar Archive
 * 
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class Archive implements Closeable {
	private static Logger logger = Logger.getLogger(Archive.class.getName());

	private IReadOnlyAccess rof;

	private final UnrarCallback unrarCallback;

	private final ComprDataIO dataIO;

	private final List<BaseBlock> headers = new ArrayList<BaseBlock>();

	private MarkHeader markHead = null;

	private MainHeader newMhd = null;

	private Unpack unpack;

	private int currentHeaderIndex;

	/** Size of packed data in current file. */
	private long totalPackedSize = 0L;

	/** Number of bytes of compressed data read from current file. */
	private long totalPackedRead = 0L;

	private VolumeManager volumeManager;
	private Volume volume;

	public Archive(VolumeManager volumeManager) throws RarException,
			IOException {
		this(volumeManager, null);
	}

	/**
	 * create a new archive object using the given {@link VolumeManager}
	 * 
	 * @param volumeManager
	 *            the the {@link VolumeManager} that will provide volume stream
	 *            data
	 * @throws RarException
	 */
	public Archive(VolumeManager volumeManager, UnrarCallback unrarCallback)
			throws RarException, IOException {
		this.volumeManager = volumeManager;
		this.unrarCallback = unrarCallback;

		setVolume(this.volumeManager.nextArchive(this, null));
		dataIO = new ComprDataIO(this);
	}

	public Archive(File firstVolume) throws RarException, IOException {
		this(new FileVolumeManager(firstVolume), null);
	}

	public Archive(File firstVolume, UnrarCallback unrarCallback)
			throws RarException, IOException {
		this(new FileVolumeManager(firstVolume), unrarCallback);
	}

	// public File getFile() {
	// return file;
	// }
	//
	// void setFile(File file) throws IOException {
	// this.file = file;
	// setFile(new ReadOnlyAccessFile(file), file.length());
	// }

	private void setFile(IReadOnlyAccess file, long length) throws IOException {
		totalPackedSize = 0L;
		totalPackedRead = 0L;
		close();
		rof = file;
		try {
			readHeaders(length);
		} catch (Exception e) {
			logger.log(Level.WARNING,
					"exception in archive constructor maybe file is encrypted "
							+ "or currupt", e);
			// ignore exceptions to allow exraction of working files in
			// corrupt archive
		}
		// Calculate size of packed data
		for (BaseBlock block : headers) {
			if (block.getHeaderType() == UnrarHeadertype.FileHeader) {
				totalPackedSize += ((FileHeader) block).getFullPackSize();
			}
		}
		if (unrarCallback != null) {
			unrarCallback.volumeProgressChanged(totalPackedRead,
					totalPackedSize);
		}
	}

	public void bytesReadRead(int count) {
		if (count > 0) {
			totalPackedRead += count;
			if (unrarCallback != null) {
				unrarCallback.volumeProgressChanged(totalPackedRead,
						totalPackedSize);
			}
		}
	}

	public IReadOnlyAccess getRof() {
		return rof;
	}

	/**
	 * @return returns all file headers of the archive
	 */
	public List<FileHeader> getFileHeaders() {
		List<FileHeader> list = new ArrayList<FileHeader>();
		for (BaseBlock block : headers) {
			if (block.getHeaderType().equals(UnrarHeadertype.FileHeader)) {
				list.add((FileHeader) block);
			}
		}
		return list;
	}

	public FileHeader nextFileHeader() {
		int n = headers.size();
		while (currentHeaderIndex < n) {
			BaseBlock block = headers.get(currentHeaderIndex++);
			if (block.getHeaderType() == UnrarHeadertype.FileHeader) {
				return (FileHeader) block;
			}
		}
		return null;
	}

	public UnrarCallback getUnrarCallback() {
		return unrarCallback;
	}

	/**
	 * 
	 * @return whether the archive is encrypted
	 */
	public boolean isEncrypted() {
		if (newMhd != null) {
			return newMhd.isEncrypted();
		} else {
			throw new NullPointerException("mainheader is null");
		}
	}

	/**
	 * Read the headers of the archive
	 * 
	 * @param fileLength
	 *            Length of file.
	 * @throws RarException
	 */
	private void readHeaders(long fileLength) throws IOException, RarException {
		markHead = null;
		newMhd = null;
		headers.clear();
		currentHeaderIndex = 0;
		int toRead = 0;

		while (true) {
			int size = 0;
			long newpos = 0;
			byte[] baseBlockBuffer = new byte[BaseBlock.BaseBlockSize];

			long position = rof.getPosition();

			// Weird, but is trying to read beyond the end of the file
			if (position >= fileLength) {
				break;
			}

			// logger.info("\n--------reading header--------");
			size = rof.readFully(baseBlockBuffer, BaseBlock.BaseBlockSize);
			if (size == 0) {
				break;
			}
			BaseBlock block = new BaseBlock(baseBlockBuffer);

			block.setPositionInFile(position);

			switch (block.getHeaderType()) {

			case MarkHeader:
				markHead = new MarkHeader(block);
				if (!markHead.isSignature()) {
					throw new RarException(
							RarException.RarExceptionType.badRarArchive);
				}
				headers.add(markHead);
				// markHead.print();
				break;

			case MainHeader:
				toRead = block.hasEncryptVersion() ? MainHeader.mainHeaderSizeWithEnc
						: MainHeader.mainHeaderSize;
				byte[] mainbuff = new byte[toRead];
				rof.readFully(mainbuff, toRead);
				MainHeader mainhead = new MainHeader(block, mainbuff);
				headers.add(mainhead);
				this.newMhd = mainhead;
				if (newMhd.isEncrypted()) {
					throw new RarException(
							RarExceptionType.rarEncryptedException);
				}
				// mainhead.print();
				break;

			case SignHeader:
				toRead = SignHeader.signHeaderSize;
				byte[] signBuff = new byte[toRead];
				rof.readFully(signBuff, toRead);
				SignHeader signHead = new SignHeader(block, signBuff);
				headers.add(signHead);
				// logger.info("HeaderType: SignHeader");

				break;

			case AvHeader:
				toRead = AVHeader.avHeaderSize;
				byte[] avBuff = new byte[toRead];
				rof.readFully(avBuff, toRead);
				AVHeader avHead = new AVHeader(block, avBuff);
				headers.add(avHead);
				// logger.info("headertype: AVHeader");
				break;

			case CommHeader:
				toRead = CommentHeader.commentHeaderSize;
				byte[] commBuff = new byte[toRead];
				rof.readFully(commBuff, toRead);
				CommentHeader commHead = new CommentHeader(block, commBuff);
				headers.add(commHead);
				// logger.info("method: "+commHead.getUnpMethod()+"; 0x"+
				// Integer.toHexString(commHead.getUnpMethod()));
				newpos = commHead.getPositionInFile()
						+ commHead.getHeaderSize();
				rof.setPosition(newpos);

				break;
			case EndArcHeader:

				toRead = 0;
				if (block.hasArchiveDataCRC()) {
					toRead += EndArcHeader.endArcArchiveDataCrcSize;
				}
				if (block.hasVolumeNumber()) {
					toRead += EndArcHeader.endArcVolumeNumberSize;
				}
				EndArcHeader endArcHead;
				if (toRead > 0) {
					byte[] endArchBuff = new byte[toRead];
					rof.readFully(endArchBuff, toRead);
					endArcHead = new EndArcHeader(block, endArchBuff);
					// logger.info("HeaderType: endarch\ndatacrc:"+
					// endArcHead.getArchiveDataCRC());
				} else {
					// logger.info("HeaderType: endarch - no Data");
					endArcHead = new EndArcHeader(block, null);
				}
				headers.add(endArcHead);
				// logger.info("\n--------end header--------");
				return;

			default:
				byte[] blockHeaderBuffer = new byte[BlockHeader.blockHeaderSize];
				rof.readFully(blockHeaderBuffer, BlockHeader.blockHeaderSize);
				BlockHeader blockHead = new BlockHeader(block,
						blockHeaderBuffer);

				switch (blockHead.getHeaderType()) {
				case NewSubHeader:
				case FileHeader:
					toRead = blockHead.getHeaderSize()
							- BlockHeader.BaseBlockSize
							- BlockHeader.blockHeaderSize;
					byte[] fileHeaderBuffer = new byte[toRead];
					rof.readFully(fileHeaderBuffer, toRead);

					FileHeader fh = new FileHeader(blockHead, fileHeaderBuffer);
					headers.add(fh);
					newpos = fh.getPositionInFile() + fh.getHeaderSize()
							+ fh.getFullPackSize();
					rof.setPosition(newpos);
					break;

				case ProtectHeader:
					toRead = blockHead.getHeaderSize()
							- BlockHeader.BaseBlockSize
							- BlockHeader.blockHeaderSize;
					byte[] protectHeaderBuffer = new byte[toRead];
					rof.readFully(protectHeaderBuffer, toRead);
					ProtectHeader ph = new ProtectHeader(blockHead,
							protectHeaderBuffer);

					newpos = ph.getPositionInFile() + ph.getHeaderSize()
							+ ph.getDataSize();
					rof.setPosition(newpos);
					break;

				case SubHeader: {
					byte[] subHeadbuffer = new byte[SubBlockHeader.SubBlockHeaderSize];
					rof.readFully(subHeadbuffer,
							SubBlockHeader.SubBlockHeaderSize);
					SubBlockHeader subHead = new SubBlockHeader(blockHead,
							subHeadbuffer);
					subHead.print();
					switch (subHead.getSubType()) {
					case MAC_HEAD: {
						byte[] macHeaderbuffer = new byte[MacInfoHeader.MacInfoHeaderSize];
						rof.readFully(macHeaderbuffer,
								MacInfoHeader.MacInfoHeaderSize);
						MacInfoHeader macHeader = new MacInfoHeader(subHead,
								macHeaderbuffer);
						macHeader.print();
						headers.add(macHeader);

						break;
					}
					// TODO implement other subheaders
					case BEEA_HEAD:
						break;
					case EA_HEAD: {
						byte[] eaHeaderBuffer = new byte[EAHeader.EAHeaderSize];
						rof.readFully(eaHeaderBuffer, EAHeader.EAHeaderSize);
						EAHeader eaHeader = new EAHeader(subHead,
								eaHeaderBuffer);
						eaHeader.print();
						headers.add(eaHeader);

						break;
					}
					case NTACL_HEAD:
						break;
					case STREAM_HEAD:
						break;
					case UO_HEAD:
						toRead = subHead.getHeaderSize();
						toRead -= BaseBlock.BaseBlockSize;
						toRead -= BlockHeader.blockHeaderSize;
						toRead -= SubBlockHeader.SubBlockHeaderSize;
						byte[] uoHeaderBuffer = new byte[toRead];
						rof.readFully(uoHeaderBuffer, toRead);
						UnixOwnersHeader uoHeader = new UnixOwnersHeader(
								subHead, uoHeaderBuffer);
						uoHeader.print();
						headers.add(uoHeader);
						break;
					default:
						break;
					}

					break;
				}
				default:
					logger.warning("Unknown Header");
					throw new RarException(RarExceptionType.notRarArchive);

				}
			}
			// logger.info("\n--------end header--------");
		}
	}

	/**
	 * Extract the file specified by the given header and write it to the
	 * supplied output stream
	 * 
	 * @param header
	 *            the header to be extracted
	 * @param os
	 *            the outputstream
	 * @throws RarException
	 */
	public void extractFile(FileHeader hd, OutputStream os) throws RarException {
		if (!headers.contains(hd)) {
			throw new RarException(RarExceptionType.headerNotInArchive);
		}
		try {
			doExtractFile(hd, os);
		} catch (Exception e) {
			if (e instanceof RarException) {
				throw (RarException) e;
			} else {
				throw new RarException(e);
			}
		}
	}

	/**
	 * Returns an {@link InputStream} that will allow to read the file and
	 * stream it. Please note that this method will create a new Thread and an a
	 * pair of Pipe streams.
	 * 
	 * @param header
	 *            the header to be extracted
	 * @throws RarException
	 * @throws IOException
	 *             if any IO error occur
	 */
	public InputStream getInputStream(final FileHeader hd) throws RarException,
			IOException {
		final PipedInputStream in = new PipedInputStream(32 * 1024);
		final PipedOutputStream out = new PipedOutputStream(in);

		// creates a new thread that will write data to the pipe. Data will be
		// available in another InputStream, connected to the OutputStream.
		new Thread(new Runnable() {
			public void run() {
				try {
					extractFile(hd, out);
				} catch (RarException e) {
				} finally {
					try {
						out.close();
					} catch (IOException e) {
					}
				}
			}
		}).start();

		return in;
	}

	private void doExtractFile(FileHeader hd, OutputStream os)
			throws RarException, IOException {
		dataIO.init(os);
		dataIO.init(hd);
		dataIO.setUnpFileCRC(this.isOldFormat() ? 0 : 0xffFFffFF);
		if (unpack == null) {
			unpack = new Unpack(dataIO);
		}
		if (!hd.isSolid()) {
			unpack.init(null);
		}
		unpack.setDestSize(hd.getFullUnpackSize());
		try {
			unpack.doUnpack(hd.getUnpVersion(), hd.isSolid());
			// Verify file CRC
			hd = dataIO.getSubHeader();
			long actualCRC = hd.isSplitAfter() ? ~dataIO.getPackedCRC()
					: ~dataIO.getUnpFileCRC();
			int expectedCRC = hd.getFileCRC();
			if (actualCRC != expectedCRC) {
				throw new RarException(RarExceptionType.crcError);
			}
			// if (!hd.isSplitAfter()) {
			// // Verify file CRC
			// if(~dataIO.getUnpFileCRC() != hd.getFileCRC()){
			// throw new RarException(RarExceptionType.crcError);
			// }
			// }
		} catch (Exception e) {
			unpack.cleanUp();
			if (e instanceof RarException) {
				// throw new RarException((RarException)e);
				throw (RarException) e;
			} else {
				throw new RarException(e);
			}
		}
	}

	/**
	 * @return returns the main header of this archive
	 */
	public MainHeader getMainHeader() {
		return newMhd;
	}

	/**
	 * @return whether the archive is old format
	 */
	public boolean isOldFormat() {
		return markHead.isOldFormat();
	}

	/** Close the underlying compressed file. */
	public void close() throws IOException {
		if (rof != null) {
			rof.close();
			rof = null;
		}
		if (unpack != null) {
			unpack.cleanUp();
		}
	}

	/**
	 * @return the volumeManager
	 */
	public VolumeManager getVolumeManager() {
		return volumeManager;
	}

	/**
	 * @param volumeManager
	 *            the volumeManager to set
	 */
	public void setVolumeManager(VolumeManager volumeManager) {
		this.volumeManager = volumeManager;
	}

	/**
	 * @return the volume
	 */
	public Volume getVolume() {
		return volume;
	}

	/**
	 * @param volume
	 *            the volume to set
	 * @throws IOException
	 */
	public void setVolume(Volume volume) throws IOException {
		this.volume = volume;
		setFile(volume.getReadOnlyAccess(), volume.getLength());
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/MVTest.java
================================================
package com.github.junrar;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import com.github.junrar.exception.RarException;
import com.github.junrar.impl.FileVolumeManager;
import com.github.junrar.rarfile.FileHeader;


public class MVTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String filename = "/home/rogiel/fs/home/ae721273-eade-45e7-8112-d14115ebae56/Village People - Y.M.C.A.mp3.part1.rar";
		File f = new File(filename);
		Archive a = null;
		try {
			a = new Archive(new FileVolumeManager(f));
		} catch (RarException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if (a != null) {
			a.getMainHeader().print();
			FileHeader fh = a.nextFileHeader();
			while (fh != null) {
				try {
					File out = new File("/home/rogiel/fs/test/"
							+ fh.getFileNameString().trim());
					System.out.println(out.getAbsolutePath());
					FileOutputStream os = new FileOutputStream(out);
					a.extractFile(fh, os);
					os.close();
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (RarException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				fh = a.nextFileHeader();
			}
		}
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/UnrarCallback.java
================================================
package com.github.junrar;


/**
 *
 * @author alban
 */
public interface UnrarCallback {

    /**
     * Return <tt>true</tt> if the next volume is ready to be processed,
     * <tt>false</tt> otherwise.
     */
    boolean isNextVolumeReady(Volume nextVolume);

    /**
     * This method is invoked each time the progress of the current
     * volume changes.
     */
    void volumeProgressChanged(long current, long total);
}


================================================
FILE: unrar/src/main/java/com/github/junrar/Volume.java
================================================
/*
 * This file is part of seedbox <github.com/seedbox>.
 *
 * seedbox is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * seedbox 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with seedbox.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.github.junrar;

import java.io.IOException;

import com.github.junrar.io.IReadOnlyAccess;


/**
 * @author <a href="http://www.rogiel.com">Rogiel</a>
 * 
 */
public interface Volume {
	/**
	 * @return the access
	 * @throws IOException
	 */
	IReadOnlyAccess getReadOnlyAccess() throws IOException;

	/**
	 * @return the data length
	 */
	long getLength();
	
	/**
	 * @return the archive this volume belongs to
	 */
	Archive getArchive();
}


================================================
FILE: unrar/src/main/java/com/github/junrar/VolumeManager.java
================================================
/*
 * This file is part of seedbox <github.com/seedbox>.
 *
 * seedbox is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * seedbox 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with seedbox.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.github.junrar;

import java.io.IOException;

/**
 * @author <a href="http://www.rogiel.com">Rogiel</a>
 * 
 */
public interface VolumeManager {
	public Volume nextArchive(Archive archive, Volume lastVolume)
			throws IOException;
}


================================================
FILE: unrar/src/main/java/com/github/junrar/crc/RarCRC.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 29.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 *  
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.crc;


/**
 * DOCUMENT ME
 * 
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class RarCRC {
	
	private final static int crcTab[];
    static {
		crcTab = new int[256];
		for (int i = 0; i < 256; i++) {
			int c = i;
			for (int j = 0; j < 8; j++){
				if ((c & 1) !=0) {
					c >>>= 1;
					c ^= 0xEDB88320;
				}
                else{
					c >>>= 1;
				}
			}
			crcTab[i] = c;
		}
    }

	private RarCRC() {
	}

	public static int checkCrc(int startCrc, byte[] data, int offset,
            int count) {
		int size = Math.min(data.length-offset,count);
		// #if defined(LITTLE_ENDIAN) && defined(PRESENT_INT32) &&
		// defined(ALLOW_NOT_ALIGNED_INT)
		/*
		for (int i = 0; (0 < size) && i < data.length - 8
				&& ((data[i + 8] & 7) != 0); i++) {
			startCrc = crcTab[(short) (startCrc ^ data[i]) & 0x00FF] ^ (startCrc >>> 8);
			size--;
		}
		
		for (int i = 0; size >= 8; i += 8) {
			startCrc ^= data[i + 0] << 24;
			startCrc ^= data[i + 1] << 16;
			startCrc ^= data[i + 2] << 8;
			startCrc ^= data[i + 3];

			startCrc = crcTab[(short) startCrc & 0x00FF] ^ (startCrc >>> 8);
			startCrc = crcTab[(short) startCrc & 0x00FF] ^ (startCrc >>> 8);
			startCrc = crcTab[(short) startCrc & 0x00FF] ^ (startCrc >>> 8);
			startCrc = crcTab[(short) startCrc & 0x00FF] ^ (startCrc >>> 8);

			startCrc ^= data[i + 4] << 24;
			startCrc ^= data[i + 5] << 16;
			startCrc ^= data[i + 6] << 8;
			startCrc ^= data[i + 7];
			startCrc = crcTab[(short) startCrc & 0x00FF] ^ (startCrc >>> 8);
			startCrc = crcTab[(short) startCrc & 0x00FF] ^ (startCrc >>> 8);
			startCrc = crcTab[(short) startCrc & 0x00FF] ^ (startCrc >>> 8);
			startCrc = crcTab[(short) startCrc & 0x00FF] ^ (startCrc >>> 8);
			size -= 8;
		}*/
		
		for (int i = 0; i < size; i++)
		{
/*
			// (byte)(StartCRC^Data[I])
			int pos = 0; // pos=0x00000000
			pos |= startCrc; // pos=ffffffff
			
			pos ^= data[i]; // data[0]=0x73=115dec --> pos=140
			System.out.println(Integer.toHexString(pos));
			
			// Only last 8 bit because CRCtab has length 256
			pos = pos & 0x000000FF;
			System.out.println("pos:"+pos);
			//startCrc >>>= 8;
			
			
			//StartCRC>>8
			int temp =0;
			temp|=startCrc;
			temp >>>= 8;
			System.out.println("temp:"+Integer.toHexString(temp));
			
			
			startCrc = (crcTab[pos]^temp);
			System.out.println("--"+Integer.toHexString(startCrc));*/
			
			startCrc=(crcTab[((int)((int)startCrc ^
                    (int)data[offset+i]))&0xff]^(startCrc>>>8));
			
			//System.out.println(Integer.toHexString(startCrc));
			
			// Original code:
			//StartCRC=CRCTab[(byte)(StartCRC^Data[I])]^(StartCRC>>8);
		}
		return (startCrc);
	}

	public static short checkOldCrc(short startCrc, byte[] data, int count) {
        int n = Math.min(data.length, count);
		for (int i = 0; i < n; i++) {
			startCrc = (short) ((short) (startCrc + (short) (data[i]&0x00ff)) & -1);
			startCrc = (short) (((startCrc << 1) | (startCrc >>> 15)) & -1);
		}
		return (startCrc);
	}

//	public static void main(String[] args)
//	{
//		RarCRC rc = new RarCRC();
//		//byte[] data = { 0x72, 0x21, 0x1A, 0x07, 0x00};
//		
//		byte[] data = {0x73 ,0x00 ,0x00 ,0x0D ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00};
//		
//		int crc = 0x90CF;
//		
//
//		int result = rc.checkCrc(0xFFFFffff, data,0,data.length);
//		System.out.println("3: "+Integer.toHexString(~result&0xffff));
//		
//	}
	
}


================================================
FILE: unrar/src/main/java/com/github/junrar/crypt/Rijndael.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 31.05.2007
 *
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.crypt;

/**
 * DOCUMENT ME
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class Rijndael {

}


================================================
FILE: unrar/src/main/java/com/github/junrar/exception/RarException.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 30.07.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.exception;

/**
 * DOCUMENT ME
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class RarException extends Exception
{
	private static final long serialVersionUID = 1L;
	private RarExceptionType type;
	
	public RarException(Exception e){
		super(RarExceptionType.unkownError.name(),e);
		this.type = RarExceptionType.unkownError;
	}
	
	public RarException(RarException e)
	{
		
		super(e.getMessage(),e);
		this.type = e.getType();
	}
	
	public RarException(RarExceptionType type){
		super(type.name());
		this.type = type;
	}
	
	
	
	public enum RarExceptionType{
		notImplementedYet,
		crcError,
		notRarArchive,
		badRarArchive,
		unkownError,
		headerNotInArchive,
		wrongHeaderType,
		ioError,
		rarEncryptedException ;
	}



	public RarExceptionType getType()
	{
		return type;
	}

	public void setType(RarExceptionType type)
	{
		this.type = type;
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/impl/FileVolume.java
================================================
/*
 * This file is part of seedbox <github.com/seedbox>.
 *
 * seedbox is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * seedbox 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with seedbox.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.github.junrar.impl;

import java.io.File;
import java.io.IOException;

import com.github.junrar.Archive;
import com.github.junrar.Volume;
import com.github.junrar.io.IReadOnlyAccess;
import com.github.junrar.io.ReadOnlyAccessFile;


/**
 * @author <a href="http://www.rogiel.com">Rogiel</a>
 * 
 */
public class FileVolume implements Volume {
	private final Archive archive;
	private final File file;

	/**
	 * @param file
	 */
	public FileVolume(Archive archive, File file) {
		this.archive = archive;
		this.file = file;
	}

	@Override
	public IReadOnlyAccess getReadOnlyAccess() throws IOException {
		return new ReadOnlyAccessFile(file);
	}

	@Override
	public long getLength() {
		return file.length();
	}

	@Override
	public Archive getArchive() {
		return archive;
	}

	/**
	 * @return the file
	 */
	public File getFile() {
		return file;
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/impl/FileVolumeManager.java
================================================
/*
 * This file is part of seedbox <github.com/seedbox>.
 *
 * seedbox is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * seedbox 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with seedbox.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.github.junrar.impl;

import java.io.File;
import java.io.IOException;

import com.github.junrar.Archive;
import com.github.junrar.Volume;
import com.github.junrar.VolumeManager;
import com.github.junrar.util.VolumeHelper;


/**
 * @author <a href="http://www.rogiel.com">Rogiel</a>
 * 
 */
public class FileVolumeManager implements VolumeManager {
	private final File firstVolume;

	public FileVolumeManager(File firstVolume) {
		this.firstVolume = firstVolume;
	}

	@Override
	public Volume nextArchive(Archive archive, Volume last)
			throws IOException {
		if (last == null)
			return new FileVolume(archive, firstVolume);

		FileVolume lastFileVolume = (FileVolume) last;
		boolean oldNumbering = !archive.getMainHeader().isNewNumbering()
				|| archive.isOldFormat();
		String nextName = VolumeHelper.nextVolumeName(lastFileVolume.getFile()
				.getAbsolutePath(), oldNumbering);
		File nextVolume = new File(nextName);

		return new FileVolume(archive, nextVolume);
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/io/IReadOnlyAccess.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 23.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.io;

import java.io.IOException;


/**
 * DOCUMENT ME
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public interface IReadOnlyAccess {

	/**
	 * @return the current position in the file
	 */
	public long getPosition() throws IOException;
		
	/**
	 * @param pos the position in the file
	 * @return success ? true : false 
	 */
	public void setPosition(long pos) throws IOException;

    /** Read a single byte of data. */
    public int read() throws IOException;

	/**
     * Read up to <tt>count</tt> bytes to the specified buffer.
     */
    public int read(byte[] buffer, int off, int count) throws IOException;

    /**
     * Read exactly <tt>count</tt> bytes to the specified buffer.
     *
	 * @param buffer where to store the read data
	 * @param count how many bytes to read
	 * @return bytes read || -1 if  IO problem 
	 */
	public int readFully(byte[] buffer, int count) throws IOException;

    /** Close this file. */
    public void close() throws IOException;
}


================================================
FILE: unrar/src/main/java/com/github/junrar/io/InputStreamReadOnlyAccessFile.java
================================================
package com.github.junrar.io;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;




/**
 * InputStream based implementation of the <code>IReadOnlyAccess</code> interface.
 * 
 * @see http://rsbweb.nih.gov/ij/
 * @author martinr
 */
public class InputStreamReadOnlyAccessFile implements IReadOnlyAccess {
	private RandomAccessStream is;

	/**
	 * Create new instance.
	 * 
	 * @param is The input stream to wrap.
	 */
	public InputStreamReadOnlyAccessFile(final InputStream is) {
		this.is = new RandomAccessStream(new BufferedInputStream(is));
	}
	
	@Override
	public long getPosition() throws IOException {
		return is.getLongFilePointer();
	}

	@Override
	public void setPosition(long pos) throws IOException {
		is.seek(pos);
	}

	@Override
	public int read() throws IOException {
		return is.read();
	}

	@Override
	public int read(byte[] buffer, int off, int count) throws IOException {
		return is.read(buffer, off, count);
	}

	@Override
	public int readFully(byte[] buffer, int count) throws IOException {
		is.readFully(buffer, count);
		return count;
	}

	@Override
	public void close() throws IOException {
		is.close();
	}

}


================================================
FILE: unrar/src/main/java/com/github/junrar/io/RandomAccessStream.java
================================================
/*
 * public domain as of http://rsbweb.nih.gov/ij/disclaimer.html
 */
package com.github.junrar.io;

import java.io.*;
import java.util.Vector;

/**
 * This is a class that uses a memory cache to allow seeking within an
 * InputStream. Based on the JAI MemoryCacheSeekableStream class. Can also be
 * constructed from a RandomAccessFile, which uses less memory since the memory
 * cache is not required.
 */
@SuppressWarnings("rawtypes")
public final class RandomAccessStream extends InputStream {

	private static final int BLOCK_SIZE = 512;
	private static final int BLOCK_MASK = 511;
	private static final int BLOCK_SHIFT = 9;

	private InputStream src;
	private RandomAccessFile ras;
	private long pointer;
	private Vector data;
	private int length;
	private boolean foundEOS;

	/**
	 * Constructs a RandomAccessStream from an InputStream. Seeking backwards is
	 * supported using a memory cache.
	 */
	public RandomAccessStream(InputStream inputstream) {
		pointer = 0L;
		data = new Vector();
		length = 0;
		foundEOS = false;
		src = inputstream;
	}

	/** Constructs a RandomAccessStream from an RandomAccessFile. */
	public RandomAccessStream(RandomAccessFile ras) {
		this.ras = ras;
	}

	public int getFilePointer() throws IOException {
		if (ras != null)
			return (int) ras.getFilePointer();
		else
			return (int) pointer;
	}

	public long getLongFilePointer() throws IOException {
		if (ras != null)
			return ras.getFilePointer();
		else
			return pointer;
	}

	public int read() throws IOException {
		if (ras != null)
			return ras.read();
		long l = pointer + 1L;
		long l1 = readUntil(l);
		if (l1 >= l) {
			byte abyte0[] = (byte[]) data
					.elementAt((int) (pointer >> BLOCK_SHIFT));
			return abyte0[(int) (pointer++ & BLOCK_MASK)] & 0xff;
		} else
			return -1;
	}

	public int read(byte[] bytes, int off, int len) throws IOException {
		if (bytes == null)
			throw new NullPointerException();
		if (ras != null)
			return ras.read(bytes, off, len);
		if (off < 0 || len < 0 || off + len > bytes.length)
			throw new IndexOutOfBoundsException();
		if (len == 0)
			return 0;
		long l = readUntil(pointer + len);
		if (l <= pointer)
			return -1;
		else {
			byte abyte1[] = (byte[]) data
					.elementAt((int) (pointer >> BLOCK_SHIFT));
			int k = Math.min(len, BLOCK_SIZE - (int) (pointer & BLOCK_MASK));
			System.arraycopy(abyte1, (int) (pointer & BLOCK_MASK), bytes, off,
					k);
			pointer += k;
			return k;
		}
	}

	public final void readFully(byte[] bytes) throws IOException {
		readFully(bytes, bytes.length);
	}

	public final void readFully(byte[] bytes, int len) throws IOException {
		int read = 0;
		do {
			int l = read(bytes, read, len - read);
			if (l < 0)
				break;
			read += l;
		} while (read < len);
	}

	@SuppressWarnings("unchecked")
	private long readUntil(long l) throws IOException {
		if (l < length)
			return l;
		if (foundEOS)
			return length;
		int i = (int) (l >> BLOCK_SHIFT);
		int j = length >> BLOCK_SHIFT;
		for (int k = j; k <= i; k++) {
			byte abyte0[] = new byte[BLOCK_SIZE];
			data.addElement(abyte0);
			int i1 = BLOCK_SIZE;
			int j1 = 0;
			while (i1 > 0) {
				int k1 = src.read(abyte0, j1, i1);
				if (k1 == -1) {
					foundEOS = true;
					return length;
				}
				j1 += k1;
				i1 -= k1;
				length += k1;
			}

		}

		return length;
	}

	public void seek(long loc) throws IOException {
		if (ras != null) {
			ras.seek(loc);
			return;
		}
		if (loc < 0L)
			pointer = 0L;
		else
			pointer = loc;
	}

	public void seek(int loc) throws IOException {
		long lloc = ((long) loc) & 0xffffffffL;
		if (ras != null) {
			ras.seek(lloc);
			return;
		}
		if (lloc < 0L)
			pointer = 0L;
		else
			pointer = lloc;
	}

	public final int readInt() throws IOException {
		int i = read();
		int j = read();
		int k = read();
		int l = read();
		if ((i | j | k | l) < 0)
			throw new EOFException();
		else
			return (i << 24) + (j << 16) + (k << 8) + l;
	}

	public final long readLong() throws IOException {
		return ((long) readInt() << 32) + ((long) readInt() & 0xffffffffL);
	}

	public final double readDouble() throws IOException {
		return Double.longBitsToDouble(readLong());
	}

	public final short readShort() throws IOException {
		int i = read();
		int j = read();
		if ((i | j) < 0)
			throw new EOFException();
		else
			return (short) ((i << 8) + j);
	}

	public final float readFloat() throws IOException {
		return Float.intBitsToFloat(readInt());
	}

	public void close() throws IOException {
		if (ras != null)
			ras.close();
		else {
			data.removeAllElements();
			src.close();
		}
	}

}

================================================
FILE: unrar/src/main/java/com/github/junrar/io/Raw.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 18.06.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.io;

/**
 * Read / write numbers to a byte[] regarding the endianness of the array
 * 
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class Raw {
    /**
     * Read a short value from the byte array at the given position (Big Endian)
     * 
     * @param array
     *            the array to read from
     * @param pos
     *            the position
     * @return the value
     */
    public static final short readShortBigEndian(byte[] array, int pos) {
	short temp = 0;
	temp |= array[pos] & 0xff;
	temp <<= 8;
	temp |= array[pos + 1] & 0xff;
	return temp;
    }

    /**
     * Read a int value from the byte array at the given position (Big Endian)
     * 
     * @param array
     *            the array to read from
     * @param pos
     *            the offset
     * @return the value
     */
    public static final int readIntBigEndian(byte[] array, int pos) {
	int temp = 0;
	temp |= array[pos] & 0xff;
	temp <<= 8;
	temp |= array[pos + 1] & 0xff;
	temp <<= 8;
	temp |= array[pos + 2] & 0xff;
	temp <<= 8;
	temp |= array[pos + 3] & 0xff;
	return temp;
    }

    /**
     * Read a long value from the byte array at the given position (Big Endian)
     * 
     * @param array
     *            the array to read from
     * @param pos
     *            the offset
     * @return the value
     */
    public static final long readLongBigEndian(byte[] array, int pos) {
	int temp = 0;
	temp |= array[pos] & 0xff;
	temp <<= 8;
	temp |= array[pos + 1] & 0xff;
	temp <<= 8;
	temp |= array[pos + 2] & 0xff;
	temp <<= 8;
	temp |= array[pos + 3] & 0xff;
	temp <<= 8;
	temp |= array[pos + 4] & 0xff;
	temp <<= 8;
	temp |= array[pos + 5] & 0xff;
	temp <<= 8;
	temp |= array[pos + 6] & 0xff;
	temp <<= 8;
	temp |= array[pos + 7] & 0xff;
	return temp;
    }

    /**
     * Read a short value from the byte array at the given position (little
     * Endian)
     * 
     * @param array
     *            the array to read from
     * @param pos
     *            the offset
     * @return the value
     */
    public static final short readShortLittleEndian(byte[] array, int pos) {
	short result = 0;
	result += array[pos + 1] & 0xff;
	result <<= 8;
	result += array[pos] & 0xff;
	return result;
    }

    /**
     * Read an int value from the byte array at the given position (little
     * Endian)
     * 
     * @param array
     *            the array to read from
     * @param pos
     *            the offset
     * @return the value
     */
    public static final int readIntLittleEndian(byte[] array, int pos) {
	return ((array[pos + 3] & 0xff) << 24)
		| ((array[pos + 2] & 0xff) << 16)
		| ((array[pos + 1] & 0xff) << 8) | ((array[pos] & 0xff));
    }

    /**
     * Read an long value(unsigned int) from the byte array at the given
     * position (little Endian)
     * 
     * @param array
     * @param pos
     * @return
     */
    public static final long readIntLittleEndianAsLong(byte[] array, int pos) {
	return (((long) array[pos + 3] & 0xff) << 24)
		| (((long) array[pos + 2] & 0xff) << 16)
		| (((long) array[pos + 1] & 0xff) << 8)
		| (((long) array[pos] & 0xff));
    }

    /**
     * Read a long value from the byte array at the given position (little
     * Endian)
     * 
     * @param array
     *            the array to read from
     * @param pos
     *            the offset
     * @return the value
     */
    public static final long readLongLittleEndian(byte[] array, int pos) {
	int temp = 0;
	temp |= array[pos + 7] & 0xff;
	temp <<= 8;
	temp |= array[pos + 6] & 0xff;
	temp <<= 8;
	temp |= array[pos + 5] & 0xff;
	temp <<= 8;
	temp |= array[pos + 4] & 0xff;
	temp <<= 8;
	temp |= array[pos + 3] & 0xff;
	temp <<= 8;
	temp |= array[pos + 2] & 0xff;
	temp <<= 8;
	temp |= array[pos + 1] & 0xff;
	temp <<= 8;
	temp |= array[pos];
	return temp;
    }

    /**
     * Write a short value into the byte array at the given position (Big
     * endian)
     * 
     * @param array
     *            the array
     * @param pos
     *            the offset
     * @param value
     *            the value to write
     */
    public static final void writeShortBigEndian(byte[] array, int pos,
	    short value) {
	array[pos] = (byte) (value >>> 8);
	array[pos + 1] = (byte) (value & 0xFF);

    }

    /**
     * Write an int value into the byte array at the given position (Big endian)
     * 
     * @param array
     *            the array
     * @param pos
     *            the offset
     * @param value
     *            the value to write
     */
    public static final void writeIntBigEndian(byte[] array, int pos, int value) {
	array[pos] = (byte) ((value >>> 24) & 0xff);
	array[pos + 1] = (byte) ((value >>> 16) & 0xff);
	array[pos + 2] = (byte) ((value >>> 8) & 0xff);
	array[pos + 3] = (byte) ((value) & 0xff);

    }

    /**
     * Write a long value into the byte array at the given position (Big endian)
     * 
     * @param array
     *            the array
     * @param pos
     *            the offset
     * @param value
     *            the value to write
     */
    public static final void writeLongBigEndian(byte[] array, int pos,
	    long value) {
	array[pos] = (byte) (value >>> 56);
	array[pos + 1] = (byte) (value >>> 48);
	array[pos + 2] = (byte) (value >>> 40);
	array[pos + 3] = (byte) (value >>> 32);
	array[pos + 4] = (byte) (value >>> 24);
	array[pos + 5] = (byte) (value >>> 16);
	array[pos + 6] = (byte) (value >>> 8);
	array[pos + 7] = (byte) (value & 0xFF);

    }

    /**
     * Write a short value into the byte array at the given position (little
     * endian)
     * 
     * @param array
     *            the array
     * @param pos
     *            the offset
     * @param value
     *            the value to write
     */
    public static final void writeShortLittleEndian(byte[] array, int pos,
	    short value) {
	array[pos + 1] = (byte) (value >>> 8);
	array[pos] = (byte) (value & 0xFF);

    }

    /**
     * Increment a short value at the specified position by the specified amount
     * (little endian).
     */
    public static final void incShortLittleEndian(byte[] array, int pos, int dv) {
	int c = ((array[pos] & 0xff) + (dv & 0xff)) >>> 8;
	array[pos] += dv & 0xff;
	if ((c > 0) || ((dv & 0xff00) != 0)) {
	    array[pos + 1] += ((dv >>> 8) & 0xff) + c;
	}
    }

    /**
     * Write an int value into the byte array at the given position (little
     * endian)
     * 
     * @param array
     *            the array
     * @param pos
     *            the offset
     * @param value
     *            the value to write
     */
    public static final void writeIntLittleEndian(byte[] array, int pos,
	    int value) {
	array[pos + 3] = (byte) (value >>> 24);
	array[pos + 2] = (byte) (value >>> 16);
	array[pos + 1] = (byte) (value >>> 8);
	array[pos] = (byte) (value & 0xFF);

    }

    /**
     * Write a long value into the byte array at the given position (little
     * endian)
     * 
     * @param array
     *            the array
     * @param pos
     *            the offset
     * @param value
     *            the value to write
     */
    public static final void writeLongLittleEndian(byte[] array, int pos,
	    long value) {
	array[pos + 7] = (byte) (value >>> 56);
	array[pos + 6] = (byte) (value >>> 48);
	array[pos + 5] = (byte) (value >>> 40);
	array[pos + 4] = (byte) (value >>> 32);
	array[pos + 3] = (byte) (value >>> 24);
	array[pos + 2] = (byte) (value >>> 16);
	array[pos + 1] = (byte) (value >>> 8);
	array[pos] = (byte) (value & 0xFF);

    }
}


================================================
FILE: unrar/src/main/java/com/github/junrar/io/ReadOnlyAccessByteArray.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 30.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.io;

import java.io.EOFException;
import java.io.IOException;

/**
 * A File like access to a byte array.
 * (seek and read certain number of bytes)
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class ReadOnlyAccessByteArray implements IReadOnlyAccess{

	private int positionInFile;
	private byte[] file;
	
	/**
	 * Initialize with byte[ ]
	 * @param file the file given as byte array
	 */
	public ReadOnlyAccessByteArray(byte[] file){
		if(file == null){
			throw new NullPointerException("file must not be null!!");
		}
		this.file = file;
		this.positionInFile = 0;
	}

    public long getPosition() throws IOException {
		return positionInFile;
	}

	public void setPosition(long pos) throws IOException {
		if (pos < file.length && pos >= 0){
			this.positionInFile = (int)pos;
		}
        else{
			throw new EOFException();
		}
	}

    /** Read a single byte of data. */
    public int read() throws IOException {
        return file[positionInFile++];
    }

	/**
     * Read up to <tt>count</tt> bytes to the specified buffer.
     */
    public int read(byte[] buffer, int off, int count) throws IOException {
        int read = Math.min(count, file.length-positionInFile);
        System.arraycopy(file, positionInFile, buffer, off, read);
        positionInFile += read;
        return read;
    }

	public int readFully(byte[] buffer, int count) throws IOException {
		if(buffer == null ){
			throw new NullPointerException("buffer must not be null");
		}
		if(count == 0){
			throw new IllegalArgumentException("cannot read 0 bytes ;-)");
		}
		int read = Math.min(count, file.length-(int)positionInFile-1);	
		System.arraycopy(file, (int)positionInFile, buffer, 0, read );
		positionInFile+=read;
		return read;
	}

    public void close() throws IOException {
    }
}


================================================
FILE: unrar/src/main/java/com/github/junrar/io/ReadOnlyAccessFile.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 23.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.io;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;

/**
 * DOCUMENT ME
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class ReadOnlyAccessFile extends RandomAccessFile
        implements IReadOnlyAccess{

	/**
	 * @param file the file
	 * @throws FileNotFoundException
	 */
	public ReadOnlyAccessFile(File file) throws FileNotFoundException {
		super(file, "r");
	}

	public int readFully(byte[] buffer, int count) throws IOException {
        assert (count > 0) : count;
        this.readFully(buffer, 0, count);
        return count;
    }

	public long getPosition() throws IOException {
        return this.getFilePointer();
	}

	public void setPosition(long pos) throws IOException {
        this.seek(pos);
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/io/ReadOnlyAccessInputStream.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 26.06.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression
 * algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.io;

import java.io.IOException;
import java.io.InputStream;

/**
 * DOCUMENT ME
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class ReadOnlyAccessInputStream extends InputStream {
	private IReadOnlyAccess file;
	
	private long curPos;
	private final long startPos;
	private final long endPos;
	
	public ReadOnlyAccessInputStream(IReadOnlyAccess file, long startPos,
            long endPos) throws IOException {
		super();
		this.file = file;
		this.startPos = startPos;
		curPos = startPos;
		this.endPos = endPos;
		file.setPosition(curPos);
	}

	@Override
	public int read() throws IOException {
        if (curPos == endPos) {
            return -1;
        }
        else {
            int b = file.read();
            curPos++;
            return b;
        }
	}

	@Override
	public int read(byte[] b, int off, int len) throws IOException {
        if (len == 0) {
            return 0;
        }
        if (curPos == endPos) {
            return -1;
        }
        int bytesRead = file.read(b, off,
                (int)Math.min(len, endPos - curPos));
        curPos += bytesRead;
        return bytesRead;
	}

	@Override
	public int read(byte[] b) throws IOException {
        return read(b, 0, b.length);
	}
//
//    public void close() throws IOException {
//        file.close();
//    }
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/AVHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 24.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import com.github.junrar.io.Raw;

/**
 * extended version info header
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class AVHeader extends BaseBlock {
	
	public static final int avHeaderSize = 7;
	
	private byte unpackVersion;
	private byte method;
	private byte avVersion;
	private int avInfoCRC;
	
	public AVHeader(BaseBlock bb, byte[] avHeader){
		super(bb);
		
		int pos =0;
		unpackVersion |= avHeader[pos]&0xff;
		pos++;
		method |= avHeader[pos]&0xff;
		pos++;
		avVersion |= avHeader[pos]&0xff;
		pos++;
		avInfoCRC = Raw.readIntLittleEndian(avHeader, pos);
	}
	
	public int getAvInfoCRC() {
		return avInfoCRC;
	}
	
	public byte getAvVersion() {
		return avVersion;
	}
	
	public byte getMethod() {
		return method;
	}
	
	public byte getUnpackVersion() {
		return unpackVersion;
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/BaseBlock.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 22.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.github.junrar.io.Raw;



/**
 * Base class of all rar headers
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class BaseBlock{
	
	Log logger = LogFactory.getLog(BaseBlock.class.getName());
	
	public static final short BaseBlockSize = 7;
	
	//TODO move somewhere else
	
	public static final short MHD_VOLUME = 0x0001;
	public static final short MHD_COMMENT = 0x0002;
	public static final short MHD_LOCK = 0x0004;
	public static final short MHD_SOLID = 0x0008;
	public static final short MHD_PACK_COMMENT = 0x0010;
	public static final short MHD_NEWNUMBERING = 0x0010;
	public static final short MHD_AV = 0x0020;
	public static final short MHD_PROTECT = 0x0040;
	public static final short MHD_PASSWORD = 0x0080;
	public static final short MHD_FIRSTVOLUME = 0x0100;
	public static final short MHD_ENCRYPTVER = 0x0200;
	
	
	public static final short LHD_SPLIT_BEFORE =  0x0001;
	public static final short LHD_SPLIT_AFTER  =  0x0002;
	public static final short LHD_PASSWORD     =  0x0004;
	public static final short LHD_COMMENT      =  0x0008;
	public static final short LHD_SOLID        =  0x0010;

	public static final short LHD_WINDOWMASK   =  0x00e0;
	public static final short LHD_WINDOW64     =  0x0000;
	public static final short LHD_WINDOW128    =  0x0020;
	public static final short LHD_WINDOW256    =  0x0040;
	public static final short LHD_WINDOW512    =  0x0060;
	public static final short LHD_WINDOW1024   =  0x0080;
	public static final short LHD_WINDOW2048   =  0x00a0;
	public static final short LHD_WINDOW4096   =  0x00c0;
	public static final short LHD_DIRECTORY    =  0x00e0;

	public static final short LHD_LARGE        =  0x0100;
	public static final short LHD_UNICODE      =  0x0200;
	public static final short LHD_SALT         =  0x0400;
	public static final short LHD_VERSION      =  0x0800;
	public static final short LHD_EXTTIME      =  0x1000;
	public static final short LHD_EXTFLAGS     =  0x2000;

	public static final short SKIP_IF_UNKNOWN  =  0x4000;
	public static final short LONG_BLOCK 	   = -0x8000;

	public static final short EARC_NEXT_VOLUME =  0x0001;
	public static final short EARC_DATACRC     =  0x0002;
	public static final short EARC_REVSPACE    =  0x0004;
	public static final short EARC_VOLNUMBER   =  0x0008;
	
	
	protected long positionInFile;
	
	protected short headCRC = 0;
	protected byte headerType = 0;
	protected short flags = 0;
	protected short headerSize = 0 ;

	/**
	 * 
	 */
	public BaseBlock(){
		
	}
	
	public BaseBlock(BaseBlock bb){
		this.flags = bb.getFlags();
    	this.headCRC = bb.getHeadCRC();
    	this.headerType = bb.getHeaderType().getHeaderByte();
    	this.headerSize = bb.getHeaderSize();
    	this.positionInFile = bb.getPositionInFile();
	}
	public BaseBlock(byte[] baseBlockHeader){
		
		int pos = 0;
		this.headCRC = Raw.readShortLittleEndian(baseBlockHeader, pos);
		pos+=2;
		this.headerType |= baseBlockHeader[pos]&0xff;
		pos++;
		this.flags = Raw.readShortLittleEndian(baseBlockHeader, pos);
		pos+=2;
		this.headerSize = Raw.readShortLittleEndian(baseBlockHeader, pos);
	}
	
	
	public boolean hasArchiveDataCRC(){
		return (this.flags & EARC_DATACRC)!=0;
	}
	
	public boolean hasVolumeNumber(){
		return (this.flags & EARC_VOLNUMBER)!=0;
	}
	
	public boolean hasEncryptVersion(){
		return (flags & MHD_ENCRYPTVER)!=0;
	}
	
	/**
	 * @return is it a sub block
	 */
	public boolean isSubBlock()
	{
		 if (UnrarHeadertype.SubHeader.equals(headerType)){
			 return(true);
		 }
		 if (UnrarHeadertype.NewSubHeader.equals(headerType) && (flags & LHD_SOLID)!=0)
		 {
			 return(true);
		 }
		 return(false);
		
	}

	public long getPositionInFile() {
		return positionInFile;
	}

	public short getFlags() {
		return flags;
	}

	public short getHeadCRC() {
		return headCRC;
	}
	
	public short getHeaderSize() {
		return headerSize;
	}

	public UnrarHeadertype getHeaderType() {
		return UnrarHeadertype.findType(headerType);
	}
	
	public void setPositionInFile(long positionInFile) {
		this.positionInFile = positionInFile;
	}
	
	public void print(){
		StringBuilder str  =new StringBuilder();
		str.append("HeaderType: " + getHeaderType());
		str.append("\nHeadCRC: "+Integer.toHexString(getHeadCRC()));
		str.append("\nFlags: "+Integer.toHexString(getFlags()));
		str.append("\nHeaderSize: "+getHeaderSize());
		str.append("\nPosition in file: "+getPositionInFile());
		logger.info(str.toString());
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/BlockHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 22.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.github.junrar.io.Raw;


/**
 * Base class of headers that contain data
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class BlockHeader extends BaseBlock{
	public static final short blockHeaderSize = 4;
	
	private Log logger = LogFactory.getLog(BlockHeader.class.getName());
	
	private int dataSize;
	private int packSize;
    
    public BlockHeader(){
    	
    }
    
    public BlockHeader(BlockHeader bh){
    	super(bh);
    	this.packSize = bh.getDataSize();
    	this.dataSize = packSize;
    	this.positionInFile = bh.getPositionInFile();
    }
    
    public BlockHeader(BaseBlock bb, byte[] blockHeader) 
    {
    	super(bb);
    	
    	this.packSize = Raw.readIntLittleEndian(blockHeader, 0);
    	this.dataSize  = this.packSize;
    }
    
	public int getDataSize() {
		return dataSize;
	}
	
	public int getPackSize() {
		return packSize;
	}
    
    public void print(){
    	super.print();
    	String s = "DataSize: "+getDataSize()+" packSize: "+getPackSize();
    	logger.info(s);
    }
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/CommentHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 23.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 *
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */

package com.github.junrar.rarfile;

import com.github.junrar.io.Raw;

/**
 * Comment header
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class CommentHeader extends BaseBlock {
	
	public static final short commentHeaderSize = 6;
	
	private short unpSize;
	private byte unpVersion;
	private byte unpMethod;
	private short commCRC;
	
	
	public CommentHeader(BaseBlock bb, byte[] commentHeader){
		super(bb);
		
		int pos =0;
		unpSize = Raw.readShortLittleEndian(commentHeader, pos);
		pos += 2;
		unpVersion |= commentHeader[pos]&0xff;
		pos++;
		
		unpMethod |= commentHeader[pos]&0xff;
		pos++;
		commCRC =Raw.readShortLittleEndian(commentHeader, pos);
		
	}
	
	public short getCommCRC() {
		return commCRC;
	}
	
	public byte getUnpMethod() {
		return unpMethod;
	}
	
	public short getUnpSize() {
		return unpSize;
	}
	
	public byte getUnpVersion() {
		return unpVersion;
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/EAHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 27.11.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.github.junrar.io.Raw;


/**
 * extended archive CRC header
 *
 */
public class EAHeader 
extends SubBlockHeader 
{
	private Log logger = LogFactory.getLog(getClass());
	
	public static final short EAHeaderSize = 10;
	
	private int unpSize;
	private byte unpVer;
	private byte method;
	private int EACRC;
	
	public EAHeader(SubBlockHeader sb, byte[] eahead)
	{
		super(sb);
		int pos = 0;
		unpSize = Raw.readIntLittleEndian(eahead, pos);
		pos+=4;
		unpVer |= eahead[pos]&0xff;
		pos++;
		method |= eahead[pos]&0xff;
		pos++;
		EACRC = Raw.readIntLittleEndian(eahead, pos);
	}

	/**
	 * @return the eACRC
	 */
	public int getEACRC() {
		return EACRC;
	}

	/**
	 * @return the method
	 */
	public byte getMethod() {
		return method;
	}

	/**
	 * @return the unpSize
	 */
	public int getUnpSize() {
		return unpSize;
	}

	/**
	 * @return the unpVer
	 */
	public byte getUnpVer() {
		return unpVer;
	}
	
	public void print()
	{
		super.print();
		logger.info("unpSize: "+unpSize);
		logger.info("unpVersion: " + unpVer);
		logger.info("method: "+method);
		logger.info("EACRC:" + EACRC);
	}
}



================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/EndArcHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 24.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import com.github.junrar.io.Raw;

/**
 * 
 * the optional End header
 * 
 */
public class EndArcHeader extends BaseBlock{
	
	private static final short EARC_NEXT_VOLUME = 0x0001;
	private static final short EARC_DATACRC = 0x0002;
	private static final short EARC_REVSPACE = 0x0004;
	private static final short EARC_VOLNUMBER = 0x0008;
	
	private static final short endArcHeaderSize = 6;
	public static final short endArcArchiveDataCrcSize = 4;
	public static final short endArcVolumeNumberSize = 2;
	
	private int archiveDataCRC;
	private short volumeNumber;
	
	
	public EndArcHeader(BaseBlock bb, byte[] endArcHeader){
		super(bb);
		
		int pos = 0;
		if(hasArchiveDataCRC()){
			archiveDataCRC =Raw.readIntLittleEndian(endArcHeader, pos);
			pos+=4;
		}
		if(hasVolumeNumber()){
			volumeNumber = Raw.readShortLittleEndian(endArcHeader, pos);
		}
	}
	
	public int getArchiveDataCRC() {
		return archiveDataCRC;
	}

	public short getVolumeNumber() {
		return volumeNumber;
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/FileHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 22.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import java.util.Calendar;
import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.github.junrar.io.Raw;


/**
 * DOCUMENT ME
 * 
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class FileHeader extends BlockHeader {

    private final Log logger = LogFactory.getLog(FileHeader.class.getName());

    private static final byte SALT_SIZE = 8;

    private static final byte NEWLHD_SIZE = 32;

    private long unpSize;

    private final HostSystem hostOS;

    private final int fileCRC;

    private final int fileTime;

    private byte unpVersion;

    private byte unpMethod;

    private short nameSize;

    private int highPackSize;

    private int highUnpackSize;

    private final byte[] fileNameBytes;

    private String fileName;
    private String fileNameW;

    private byte[] subData;

    private final byte[] salt = new byte[SALT_SIZE];

    private Date mTime;

    private Date cTime;

    private Date aTime;

    private Date arcTime;

    private long fullPackSize;

    private long fullUnpackSize;

    private int fileAttr;

    private int subFlags; // same as fileAttr (in header)

    private int recoverySectors = -1;

    public FileHeader(BlockHeader bh, byte[] fileHeader) {
	super(bh);

	int position = 0;
	unpSize = Raw.readIntLittleEndianAsLong(fileHeader, position);
	position += 4;
	hostOS = HostSystem.findHostSystem(fileHeader[4]);
	position++;

	fileCRC = Raw.readIntLittleEndian(fileHeader, position);
	position += 4;

	fileTime = Raw.readIntLittleEndian(fileHeader, position);
	position += 4;

	unpVersion |= fileHeader[13] & 0xff;
	position++;
	unpMethod |= fileHeader[14] & 0xff;
	position++;
	nameSize = Raw.readShortLittleEndian(fileHeader, position);
	position += 2;

	fileAttr = Raw.readIntLittleEndian(fileHeader, position);
	position += 4;
	if (isLargeBlock()) {
	    highPackSize = Raw.readIntLittleEndian(fileHeader, position);
	    position += 4;

	    highUnpackSize = Raw.readIntLittleEndian(fileHeader, position);
	    position += 4;
	} else {
	    highPackSize = 0;
	    highUnpackSize = 0;
	    if (unpSize == 0xffffffff) {

		unpSize = 0xffffffff;
		highUnpackSize = Integer.MAX_VALUE;
	    }

	}
	fullPackSize |= highPackSize;
	fullPackSize <<= 32;
	fullPackSize |= getPackSize();

	fullUnpackSize |= highUnpackSize;
	fullUnpackSize <<= 32;
	fullUnpackSize += unpSize;

	nameSize = nameSize > 4 * 1024 ? 4 * 1024 : nameSize;

	fileNameBytes = new byte[nameSize];
	for (int i = 0; i < nameSize; i++) {
	    fileNameBytes[i] = fileHeader[position];
	    position++;
	}

	if (isFileHeader()) {
	    if (isUnicode()) {
		int length = 0;
		fileName = "";
		fileNameW = "";
		while (length < fileNameBytes.length
			&& fileNameBytes[length] != 0) {
		    length++;
		}
		byte[] name = new byte[length];
		System.arraycopy(fileNameBytes, 0, name, 0, name.length);
		fileName = new String(name);
		if (length != nameSize) {
		    length++;
		    fileNameW = FileNameDecoder.decode(fileNameBytes, length);
		}
	    } else {
		fileName = new String(fileNameBytes);
		fileNameW = "";
	    }
	}

	if (UnrarHeadertype.NewSubHeader.equals(headerType)) {
	    int datasize = headerSize - NEWLHD_SIZE - nameSize;
	    if (hasSalt()) {
		datasize -= SALT_SIZE;
	    }
	    if (datasize > 0) {
		subData = new byte[datasize];
		for (int i = 0; i < datasize; i++) {
		    subData[i] = (fileHeader[position]);
		    position++;
		}
	    }

	    if (NewSubHeaderType.SUBHEAD_TYPE_RR.byteEquals(fileNameBytes)) {
		recoverySectors = subData[8] + (subData[9] << 8)
			+ (subData[10] << 16) + (subData[11] << 24);
	    }
	}

	if (hasSalt()) {
	    for (int i = 0; i < SALT_SIZE; i++) {
		salt[i] = fileHeader[position];
		position++;
	    }
	}
	mTime = getDateDos(fileTime);
	// TODO rartime -> extended

    }

    @Override
    public void print() {
	super.print();
	StringBuilder str = new StringBuilder();
	str.append("unpSize: " + getUnpSize());
	str.append("\nHostOS: " + hostOS.name());
	str.append("\nMDate: " + mTime);
	str.append("\nFileName: " + getFileNameString());
	str.append("\nunpMethod: " + Integer.toHexString(getUnpMethod()));
	str.append("\nunpVersion: " + Integer.toHexString(getUnpVersion()));
	str.append("\nfullpackedsize: " + getFullPackSize());
	str.append("\nfullunpackedsize: " + getFullUnpackSize());
	str.append("\nisEncrypted: " + isEncrypted());
	str.append("\nisfileHeader: " + isFileHeader());
	str.append("\nisSolid: " + isSolid());
	str.append("\nisSplitafter: " + isSplitAfter());
	str.append("\nisSplitBefore:" + isSplitBefore());
	str.append("\nunpSize: " + getUnpSize());
	str.append("\ndataSize: " + getDataSize());
	str.append("\nisUnicode: " + isUnicode());
	str.append("\nhasVolumeNumber: " + hasVolumeNumber());
	str.append("\nhasArchiveDataCRC: " + hasArchiveDataCRC());
	str.append("\nhasSalt: " + hasSalt());
	str.append("\nhasEncryptVersions: " + hasEncryptVersion());
	str.append("\nisSubBlock: " + isSubBlock());
	logger.info(str.toString());
    }

    private Date getDateDos(int time) {
	Calendar cal = Calendar.getInstance();
	cal.set(Calendar.YEAR, (time >>> 25) + 1980);
	cal.set(Calendar.MONTH, ((time >>> 21) & 0x0f) - 1);
	cal.set(Calendar.DAY_OF_MONTH, (time >>> 16) & 0x1f);
	cal.set(Calendar.HOUR_OF_DAY, (time >>> 11) & 0x1f);
	cal.set(Calendar.MINUTE, (time >>> 5) & 0x3f);
	cal.set(Calendar.SECOND, (time & 0x1f) * 2);
	return cal.getTime();
    }

    public Date getArcTime() {
	return arcTime;
    }

    public void setArcTime(Date arcTime) {
	this.arcTime = arcTime;
    }

    public Date getATime() {
	return aTime;
    }

    public void setATime(Date time) {
	aTime = time;
    }

    public Date getCTime() {
	return cTime;
    }

    public void setCTime(Date time) {
	cTime = time;
    }

    public int getFileAttr() {
	return fileAttr;
    }

    public void setFileAttr(int fileAttr) {
	this.fileAttr = fileAttr;
    }

    public int getFileCRC() {
	return fileCRC;
    }

    public byte[] getFileNameByteArray() {
	return fileNameBytes;
    }

    public String getFileNameString() {
	return fileName;
    }

    public void setFileName(String fileName) {
	this.fileName = fileName;
    }

    public String getFileNameW() {
	return fileNameW;
    }

    public void setFileNameW(String fileNameW) {
	this.fileNameW = fileNameW;
    }

    public int getHighPackSize() {
	return highPackSize;
    }

    public int getHighUnpackSize() {
	return highUnpackSize;
    }

    public HostSystem getHostOS() {
	return hostOS;
    }

    public Date getMTime() {
	return mTime;
    }

    public void setMTime(Date time) {
	mTime = time;
    }

    public short getNameSize() {
	return nameSize;
    }

    public int getRecoverySectors() {
	return recoverySectors;
    }

    public byte[] getSalt() {
	return salt;
    }

    public byte[] getSubData() {
	return subData;
    }

    public int getSubFlags() {
	return subFlags;
    }

    public byte getUnpMethod() {
	return unpMethod;
    }

    public long getUnpSize() {
	return unpSize;
    }

    public byte getUnpVersion() {
	return unpVersion;
    }

    public long getFullPackSize() {
	return fullPackSize;
    }

    public long getFullUnpackSize() {
	return fullUnpackSize;
    }

    @Override
    public String toString() {
	return super.toString();
    }

    /**
     * the file will be continued in the next archive part
     * 
     * @return
     */
    public boolean isSplitAfter() {
	return (this.flags & BlockHeader.LHD_SPLIT_AFTER) != 0;
    }

    /**
     * the file is continued in this archive
     * 
     * @return
     */
    public boolean isSplitBefore() {
	return (this.flags & LHD_SPLIT_BEFORE) != 0;
    }

    /**
     * this file is compressed as solid (all files handeled as one)
     * 
     * @return
     */
    public boolean isSolid() {
	return (this.flags & LHD_SOLID) != 0;
    }

    /**
     * the file is encrypted
     * 
     * @return
     */
    public boolean isEncrypted() {
	return (this.flags & BlockHeader.LHD_PASSWORD) != 0;
    }

    /**
     * the filename is also present in unicode
     * 
     * @return
     */
    public boolean isUnicode() {
	return (flags & LHD_UNICODE) != 0;
    }

    public boolean isFileHeader() {
	return UnrarHeadertype.FileHeader.equals(headerType);
    }

    public boolean hasSalt() {
	return (flags & LHD_SALT) != 0;
    }

    public boolean isLargeBlock() {
	return (flags & LHD_LARGE) != 0;
    }

    /**
     * whether this fileheader represents a directory
     * 
     * @return
     */
    public boolean isDirectory() {
	return (flags & LHD_WINDOWMASK) == LHD_DIRECTORY;
    }
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/FileNameDecoder.java
================================================
/*
 * 
 * Original author: alpha_lam
 * Creation date: ?
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

public class FileNameDecoder {
	public static int getChar(byte [] name,int pos){ 
		return name[pos]&0xff; 
	} 

	public static String decode(byte [] name,int encPos){ 
		int decPos = 0; 
		int flags = 0; 
		int flagBits = 0; 

		int low = 0; 
		int high = 0; 
		int highByte = getChar(name,encPos++); 
		StringBuffer buf = new StringBuffer(); 
		while(encPos < name.length){ 
			if(flagBits == 0){ 
				flags = getChar(name,encPos++); 
				flagBits = 8; 
			} 
			switch(flags >> 6){ 
			case 0: 
				buf.append((char)(getChar(name,encPos++))); 
				++decPos; 
				break; 
			case 1: 
				buf.append((char)(getChar(name,encPos++)+(highByte<<8))); 
				++decPos; 
				break; 
			case 2: 
				low = getChar(name,encPos); 
				high = getChar(name,encPos+1); 
				buf.append((char)((high << 8) + low)); 
				++decPos; 
				encPos += 2; 
				break; 
			case 3: 
				int length = getChar(name,encPos++); 
				if((length&0x80)!=0){ 
					int correction = getChar(name,encPos++); 
					for(length=(length&0x7f)+2;length>0&&decPos<name.length;length--,decPos++){ 
						low = (getChar(name,decPos) + correction)&0xff; 
						buf.append((char)((highByte << 8) + low)); 
					} 
				}else{ 
					for(length+=2;length>0&&decPos<name.length;length--,decPos++){ 
						buf.append((char)(getChar(name,decPos))); 
					} 
				} 
				break; 
			} 
			flags = (flags << 2) & 0xff; 
			flagBits -= 2; 
		} 
		return buf.toString(); 
	} 
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/HostSystem.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 22.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

/**
 * DOCUMENT ME
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public enum HostSystem {
	msdos  ((byte)0),
	os2  ((byte)1),
	win32  ((byte)2),
	unix  ((byte)3),
	macos  ((byte)4),
	beos   ((byte)5);
	
	private byte hostByte;
	
	public static HostSystem findHostSystem(byte hostByte){
		if(HostSystem.msdos.equals(hostByte)){
			return HostSystem.msdos;
		}
		if(HostSystem.os2.equals(hostByte)){
			return HostSystem.os2;
		}
		if(HostSystem.win32.equals(hostByte)){
			return HostSystem.win32;
		}
		if(HostSystem.unix.equals(hostByte)){
			return HostSystem.unix;
		}
		if(HostSystem.macos.equals(hostByte)){
			return HostSystem.macos;
		}
		if(HostSystem.beos.equals(hostByte)){
			return HostSystem.beos;
		}
		return null;
	}
	
	
	private HostSystem(byte hostByte){
		this.hostByte = hostByte;
	}
	
	public boolean equals(byte hostByte){
		return this.hostByte == hostByte;
	}
	
	public byte getHostByte(){
		return hostByte;
	}
	//???? public static final byte max = 6; 
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/MacInfoHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 26.11.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.github.junrar.io.Raw;


/**
 * Mac File attribute header
 *
 */
public class MacInfoHeader 
extends SubBlockHeader 
{
	private Log logger = LogFactory.getLog(getClass());
	
	public static final short MacInfoHeaderSize = 8;
	
	private int fileType;
	private int fileCreator;
	
	public MacInfoHeader(SubBlockHeader sb, byte[] macHeader)
	{
		super(sb);
		int pos = 0;
		fileType = Raw.readIntLittleEndian(macHeader, pos);
		pos+=4;
		fileCreator = Raw.readIntLittleEndian(macHeader, pos);
	}

	/**
	 * @return the fileCreator
	 */
	public int getFileCreator() {
		return fileCreator;
	}

	/**
	 * @param fileCreator the fileCreator to set
	 */
	public void setFileCreator(int fileCreator) {
		this.fileCreator = fileCreator;
	}

	/**
	 * @return the fileType
	 */
	public int getFileType() {
		return fileType;
	}

	/**
	 * @param fileType the fileType to set
	 */
	public void setFileType(int fileType) {
		this.fileType = fileType;
	}
	
	public void print(){
		super.print();
		logger.info("filetype: "+fileType);
		logger.info("creator :"+fileCreator);
	}
	
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/MainHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 22.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.github.junrar.io.Raw;


/**
 * The main header of an rar archive. holds information concerning the whole archive (solid, encrypted etc). 
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class MainHeader extends BaseBlock {
	private Log logger = LogFactory.getLog(MainHeader.class.getName());
	public static final short mainHeaderSizeWithEnc = 7;
	public static final short mainHeaderSize = 6;
	private short highPosAv;
	private int posAv;
	private byte encryptVersion;
	
	public MainHeader(BaseBlock bb, byte[] mainHeader) {
		super(bb);
		int pos = 0;
		highPosAv = Raw.readShortLittleEndian(mainHeader, pos);
		pos += 2;
		posAv = Raw.readIntLittleEndian(mainHeader, pos);
		pos+=4;
		
		if(hasEncryptVersion()){
			encryptVersion |= mainHeader[pos]&0xff;
		}
	}
	
	/**
	 * old cmt block is present
	 * @return true if has cmt block
	 */
	public boolean hasArchCmt(){
		return (this.flags & BaseBlock.MHD_COMMENT)!=0;
	}
	/**
	 * the version the the encryption 
	 * @return
	 */
	public byte getEncryptVersion() {
		return encryptVersion;
	}
	
	public short getHighPosAv() {
		return highPosAv;
	}
	
	public int getPosAv() {
		return posAv;
	}
	
	/**
	 * returns whether the archive is encrypted 
	 * @return
	 */
	public boolean isEncrypted(){
		return (this.flags & BaseBlock.MHD_PASSWORD)!=0;
	}
	
	/**
	 * return whether the archive is a multivolume archive
	 * @return
	 */
	public boolean isMultiVolume(){
		return (this.flags & BaseBlock.MHD_VOLUME)!=0;
	}
	
	/**
	 * if the archive is a multivolume archive this method returns whether this instance is the first part of the multivolume archive
	 * @return
	 */
	public boolean isFirstVolume(){
		return (this.flags & BaseBlock.MHD_FIRSTVOLUME)!=0;
	}
	
	public void print(){
		super.print();
		StringBuilder str=new StringBuilder();
		str.append("posav: "+getPosAv());
		str.append("\nhighposav: "+getHighPosAv());
		str.append("\nhasencversion: "+hasEncryptVersion()+(hasEncryptVersion()?getEncryptVersion():""));
		str.append("\nhasarchcmt: "+hasArchCmt());
		str.append("\nisEncrypted: "+isEncrypted());
		str.append("\nisMultivolume: "+isMultiVolume());
		str.append("\nisFirstvolume: "+isFirstVolume());
		str.append("\nisSolid: "+isSolid());
		str.append("\nisLocked: "+isLocked());
		str.append("\nisProtected: "+isProtected());
		str.append("\nisAV: "+isAV());
		logger.info(str.toString());
	}
	
	/**
	 * returns whether this archive is solid. in this case you can only extract all file at once
	 * @return
	 */
	public boolean isSolid(){
		return (this.flags&MHD_SOLID)!=0;
	}
	
	public boolean isLocked(){
		return (this.flags&MHD_LOCK)!=0;
	}
	
	public boolean isProtected(){
		return (this.flags&MHD_PROTECT)!=0;
	}
	
	public boolean isAV(){
		return (this.flags&MHD_AV)!=0;
	}
	/**
	 * the numbering format a multivolume archive
	 * @return
	 */
	public boolean isNewNumbering(){
		return (this.flags&MHD_NEWNUMBERING)!=0;
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/MarkHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 24.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.github.junrar.io.Raw;


/**
 * the header to recognize a file to be a rar archive
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class MarkHeader extends BaseBlock {
	
	private Log logger = LogFactory.getLog(MarkHeader.class.getName());
	private boolean oldFormat = false;
	
	public MarkHeader(BaseBlock bb){
		super(bb);
	}
	public boolean isValid(){
		if(!(getHeadCRC() == 0x6152)){
			return false;
		}
		if(!(getHeaderType() == UnrarHeadertype.MarkHeader)){
			return false;
		}
		if(!(getFlags() == 0x1a21)){
			return false;
		}
		if(!(getHeaderSize() == BaseBlockSize)){
			return false;
		}
		return true;
	}
	
	public boolean isSignature() {
        boolean valid=false;
        byte[] d = new byte[BaseBlock.BaseBlockSize];
        Raw.writeShortLittleEndian(d, 0, headCRC);
        d[2] = headerType;
        Raw.writeShortLittleEndian(d, 3, flags);
        Raw.writeShortLittleEndian(d, 5, headerSize);
        
        if (d[0] == 0x52) {
            if (d[1]==0x45 && d[2]==0x7e && d[3]==0x5e) {
                oldFormat=true;
                valid=true;
            }
            else if (d[1]==0x61 && d[2]==0x72 && d[3]==0x21 && d[4]==0x1a &&
                    d[5]==0x07 && d[6]==0x00) {
                oldFormat=false;
                valid=true;
            }
        }
        return valid;
    }

    public boolean isOldFormat() {
        return oldFormat;
    }
    
	public void print(){
		super.print();
		logger.info("valid: "+isValid());
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/NewSubHeaderType.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 24.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import java.util.Arrays;

/**
 * subheaders new version of the info headers
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class NewSubHeaderType {
    
    /**
     * comment subheader
     */
    public static final NewSubHeaderType SUBHEAD_TYPE_CMT = new NewSubHeaderType(new byte[]{'C','M','T'});
    /**
     * 
     */
    public static final NewSubHeaderType SUBHEAD_TYPE_ACL = new NewSubHeaderType(new byte[]{'A','C','L'});
    /**
     * 
     */
    public static final NewSubHeaderType SUBHEAD_TYPE_STREAM = new NewSubHeaderType(new byte[]{'S','T','M'});
    /**
     * 
     */
    public static final NewSubHeaderType SUBHEAD_TYPE_UOWNER = new NewSubHeaderType(new byte[]{'U','O','W'});
    /**
     * 
     */
    public static final NewSubHeaderType SUBHEAD_TYPE_AV = new NewSubHeaderType(new byte[]{'A','V'});
    /**
     * recovery record subheader
     */
    public static final NewSubHeaderType SUBHEAD_TYPE_RR = new NewSubHeaderType(new byte[]{'R','R'});
    /**
     * 
     */
    public static final NewSubHeaderType SUBHEAD_TYPE_OS2EA = new NewSubHeaderType(new byte[]{'E','A','2'});
    /**
     * 
     */
    public static final NewSubHeaderType SUBHEAD_TYPE_BEOSEA = new NewSubHeaderType(new byte[]{'E','A','B','E'});
    
    private byte[] headerTypes;
    
    /**
     * Private constructor
     * @param headerTypes
     */
    private NewSubHeaderType(byte[] headerTypes)
    {
        this.headerTypes = headerTypes;
    }
    
    /**
     * @param toCompare
     * @return Returns true if the given byte array matches to the internal byte array of this header.
     */
    public boolean byteEquals(byte[] toCompare)
    {
        return Arrays.equals(this.headerTypes, toCompare);
    }

    @Override
    public String toString()
    {
        return new String(this.headerTypes);
    }
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/ProtectHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 24.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import com.github.junrar.io.Raw;

/**
 * recovery header
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class ProtectHeader extends BlockHeader {
		
	/**
	 * the header size
	 */
	public static final int protectHeaderSize = 8;
	
	private byte version;
	private short recSectors;
	private int totalBlocks;
	private byte mark;
	
	
	public ProtectHeader(BlockHeader bh, byte[] protectHeader){
		super(bh);
		
		int pos = 0;
		version |= protectHeader[pos]&0xff;
		
		recSectors = Raw.readShortLittleEndian(protectHeader, pos);
		pos += 2;
		totalBlocks = Raw.readIntLittleEndian(protectHeader, pos);
		pos += 4;
		mark |= protectHeader[pos]&0xff;
	}
	
	
	public byte getMark() {
		return mark;
	}
	
	public short getRecSectors() {
		return recSectors;
	}
	
	public int getTotalBlocks() {
		return totalBlocks;
	}
	
	public byte getVersion() {
		return version;
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/SignHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 24.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import com.github.junrar.io.Raw;

/**
 * sign header
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class SignHeader extends BaseBlock {
	
	public static final short signHeaderSize = 8;
	
	private int creationTime=0;
	private short arcNameSize=0;
	private short userNameSize=0;
	
	
	public SignHeader(BaseBlock bb, byte[] signHeader){
		super(bb);
		
		int pos = 0;
		creationTime = Raw.readIntLittleEndian(signHeader, pos);
		pos +=4;
		arcNameSize = Raw.readShortLittleEndian(signHeader, pos);
		pos+=2;
		userNameSize = Raw.readShortLittleEndian(signHeader, pos);
	}
	
	public short getArcNameSize() {
		return arcNameSize;
	}
	
	public int getCreationTime() {
		return creationTime;
	}
	
	public short getUserNameSize() {
		return userNameSize;
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/SubBlockHeader.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 21.11.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.github.junrar.io.Raw;


public class SubBlockHeader 
extends BlockHeader 
{
	private Log logger = LogFactory.getLog(getClass());
	
	public static final short SubBlockHeaderSize = 3;
	
	private short subType;
	private byte level;
	
	public SubBlockHeader(SubBlockHeader sb)
	{
		super(sb);
		subType = sb.getSubType().getSubblocktype();
		level = sb.getLevel();
	}
	
	public SubBlockHeader(BlockHeader bh, byte[] subblock)
	{
		super(bh);
		int position = 0;
		subType = Raw.readShortLittleEndian(subblock, position);
		position +=2;
		level |= subblock[position]&0xff;
	}

	/**
	 * @return
	 */
	public byte getLevel() {
		return level;
	}

	/**
	 * @return
	 */
	public SubBlockHeaderType getSubType() {
		return SubBlockHeaderType.findSubblockHeaderType(subType);
	}

	public void print()
	{
		super.print();
		logger.info("subtype: "+getSubType());
		logger.info("level: "+level);
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/SubBlockHeaderType.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 20.11.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */

package com.github.junrar.rarfile;

public enum SubBlockHeaderType 
{
	EA_HEAD 	((short)0x100),
	UO_HEAD 	((short)0x101),
	MAC_HEAD 	((short)0x102),
	BEEA_HEAD 	((short)0x103),
    NTACL_HEAD 	((short)0x104),
    STREAM_HEAD ((short)0x105);
	
	private short subblocktype;

	private SubBlockHeaderType(short subblocktype)
	{
		this.subblocktype = subblocktype;
	}
	
	/**
	 * Return true if the given value is equal to the enum's value
	 * @param subblocktype
	 * @return true if the given value is equal to the enum's value
	 */
	public boolean equals(short subblocktype)
	{
		return this.subblocktype == subblocktype;
	}

	/**
	 * find the header type for the given short value
	 * @param SubType the short value
	 * @return the correspo nding enum or null
	 */
	public static SubBlockHeaderType findSubblockHeaderType(short subType)
	{
		if(EA_HEAD.equals(subType)){
			return EA_HEAD;
		}else if(UO_HEAD.equals(subType)){
			return UO_HEAD;
		}else if(MAC_HEAD.equals(subType)){
			return MAC_HEAD;
		}else if(BEEA_HEAD.equals(subType)){
			return BEEA_HEAD;
		}else if(NTACL_HEAD.equals(subType)){
			return NTACL_HEAD;
		}else if(STREAM_HEAD.equals(subType)){
			return STREAM_HEAD;
		}
		return null;
	}
	
	/**
	 * @return the short representation of this enum
	 */
	public short getSubblocktype() {
		return subblocktype;
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/UnixOwnersHeader.java
================================================
package com.github.junrar.rarfile;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.github.junrar.io.Raw;


public class UnixOwnersHeader 
extends SubBlockHeader 
{
	private Log logger = LogFactory.getLog(UnixOwnersHeader.class);
	private int ownerNameSize;
	private int groupNameSize;
	private String owner;
	private String group;
	
	public  UnixOwnersHeader(SubBlockHeader sb, byte[] uoHeader) {
		super(sb);
		int pos = 0;
		ownerNameSize = Raw.readShortLittleEndian(uoHeader, pos)&0xFFFF;
		pos+=2;
		groupNameSize = Raw.readShortLittleEndian(uoHeader, pos)&0xFFFF;
		pos+=2;
		if(pos+ownerNameSize<uoHeader.length){
			byte[] ownerBuffer = new byte[ownerNameSize];
			System.arraycopy(uoHeader, pos, ownerBuffer, 0, ownerNameSize);
			owner = new String(ownerBuffer);
		}
		pos+=ownerNameSize;
		if(pos+groupNameSize<uoHeader.length){
			byte[] groupBuffer = new byte[groupNameSize];
			System.arraycopy(uoHeader, pos, groupBuffer, 0, groupNameSize);
			group = new String(groupBuffer);
		}
	}
	/**
	 * @return the group
	 */
	public String getGroup() {
		return group;
	}
	/**
	 * @param group the group to set
	 */
	public void setGroup(String group) {
		this.group = group;
	}
	/**
	 * @return the groupNameSize
	 */
	public int getGroupNameSize() {
		return groupNameSize;
	}
	/**
	 * @param groupNameSize the groupNameSize to set
	 */
	public void setGroupNameSize(int groupNameSize) {
		this.groupNameSize = groupNameSize;
	}
	/**
	 * @return the owner
	 */
	public String getOwner() {
		return owner;
	}
	/**
	 * @param owner the owner to set
	 */
	public void setOwner(String owner) {
		this.owner = owner;
	}
	/**
	 * @return the ownerNameSize
	 */
	public int getOwnerNameSize() {
		return ownerNameSize;
	}
	/**
	 * @param ownerNameSize the ownerNameSize to set
	 */
	public void setOwnerNameSize(int ownerNameSize) {
		this.ownerNameSize = ownerNameSize;
	}
	
	/* (non-Javadoc)
	 * @see de.innosystec.unrar.rarfile.SubBlockHeader#print()
	 */
	public void print(){
		super.print();
		logger.info("ownerNameSize: "+ownerNameSize);
		logger.info("owner: "+owner);
		logger.info("groupNameSize: "+groupNameSize);
		logger.info("group: "+group);
	}
}


================================================
FILE: unrar/src/main/java/com/github/junrar/rarfile/UnrarHeadertype.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 22.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 *
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.rarfile;

/**
 * DOCUMENT ME
 *
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public enum UnrarHeadertype {
	
	
	/**
	 * 
	 */
	MainHeader		((byte)0x73),
	
	/**
	 * 
	 */
	MarkHeader		((byte)0x72),
	
	/**
	 * 
	 */
	FileHeader 		((byte) 0x74),
	
	/**
	 * 
	 */
	CommHeader  	((byte) 0x75),
	
	/**
	 * 
	 */
	AvHeader 		((byte) 0x76),
	
	/**
	 * 
	 */
	SubHeader 		((byte)  0x77),
	
	/**
	 * 
	 */
	ProtectHeader  	((byte) 0x78),
	
	/**
	 * 
	 */
	SignHeader 		((byte)  0x79),
	
	/**
	 * 
	 */
	NewSubHeader 	((byte) 0x7a),
	
	/**
	 * 
	 */
	EndArcHeader 	((byte)  0x7b);
	
	/**
	 * Returns the enum according to the given byte or null 
	 * @param headerType the headerbyte
	 * @return the enum or null
	 */
	public static UnrarHeadertype findType(byte headerType) 
	{
		if(UnrarHeadertype.MarkHeader.equals(headerType)){
			return UnrarHeadertype.MarkHeader;
		}
		if(UnrarHeadertype.MainHeader.equals(headerType)){
			return UnrarHeadertype.MainHeader;
		}
		if(UnrarHeadertype.FileHeader.equals(headerType)){
			return UnrarHeadertype.FileHeader;
		}
		if(UnrarHeadertype.EndArcHeader.equals(headerType)){
			return UnrarHeadertype.EndArcHeader;
		}
		if(UnrarHeadertype.NewSubHeader.equals(headerType)){
			return UnrarHeadertype.NewSubHeader;
		}
		if(UnrarHeadertype.SubHeader.equals(headerType)){
			return UnrarHeadertype.SubHeader;
		}
		if(UnrarHeadertype.SignHeader.equals(headerType)){
			return UnrarHeadertype.SignHeader;
		}
		if(UnrarHeadertype.ProtectHeader.equals(headerType)){
			return UnrarHeadertype.ProtectHeader;
		}
		if(UnrarHeadertype.MarkHeader.equals(headerType)){
			return UnrarHeadertype.MarkHeader;
		}
		if(UnrarHeadertype.MainHeader.equals(headerType)){
			return UnrarHeadertype.MainHeader;
		}
		if(UnrarHeadertype.FileHeader.equals(headerType)){
			return UnrarHeadertype.FileHeader;
		}
		if(UnrarHeadertype.EndArcHeader.equals(headerType)){
			return UnrarHeadertype.EndArcHeader;
		}
		if(UnrarHeadertype.CommHeader.equals(headerType)){
			return UnrarHeadertype.CommHeader;
		}
		if(UnrarHeadertype.AvHeader.equals(headerType)){
			return UnrarHeadertype.AvHeader;
		}
		return null;
	}

	
	
	private byte headerByte;
	
	private UnrarHeadertype(byte headerByte)
	{
		this.headerByte = headerByte;
	}

	
	/**
	 * Return true if the given byte is equal to the enum's byte
	 * @param header
	 * @return true if the given byte is equal to the enum's byte
	 */
	public boolean equals(byte header)
	{
		return headerByte == header;
	}


	/**
	 * the header byte of this enum
	 * @return the header byte of this enum
	 */
	public byte getHeaderByte() {
		return headerByte;
	}


	
	
}


================================================
FILE: unrar/src/main/java/com/github/junrar/unpack/ComprDataIO.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 31.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.unpack;

import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import com.github.junrar.Archive;
import com.github.junrar.UnrarCallback;
import com.github.junrar.Volume;
import com.github.junrar.crc.RarCRC;
import com.github.junrar.exception.RarException;
import com.github.junrar.exception.RarException.RarExceptionType;
import com.github.junrar.io.ReadOnlyAccessInputStream;
import com.github.junrar.rarfile.FileHeader;


/**
 * DOCUMENT ME
 * 
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class ComprDataIO {

	private final Archive archive;

	private long unpPackedSize;

	private boolean testMode;

	private boolean skipUnpCRC;

	private InputStream inputStream;

	private OutputStream outputStream;

	private FileHeader subHead;

	// cryptData Crypt;
	// cryptData Decrypt;
	private boolean packVolume;

	private boolean unpVolume;

	private boolean nextVolumeMissing;

	private long totalPackRead;

	private long unpArcSize;

	private long curPackRead, curPackWrite, curUnpRead, curUnpWrite;

	private long processedArcSize, totalArcSize;

	private long packFileCRC, unpFileCRC, packedCRC;

	private int encryption;

	private int decryption;

	private int lastPercent;

	private char currentCommand;

	public ComprDataIO(Archive arc) {
		this.archive = arc;
	}

	public void init(OutputStream outputStream) {
		this.outputStream = outputStream;
		unpPackedSize = 0;
		testMode = false;
		skipUnpCRC = false;
		packVolume = false;
		unpVolume = false;
		nextVolumeMissing = false;
		// command = null;
		encryption = 0;
		decryption = 0;
		totalPackRead = 0;
		curPackRead = curPackWrite = curUnpRead = curUnpWrite = 0;
		packFileCRC = unpFileCRC = packedCRC = 0xffffffff;
		lastPercent = -1;
		subHead = null;

		currentCommand = 0;
		processedArcSize = totalArcSize = 0;
	}

	public void init(FileHeader hd) throws IOException {
		long startPos = hd.getPositionInFile() + hd.getHeaderSize();
		unpPackedSize = hd.getFullPackSize();
		inputStream = new ReadOnlyAccessInputStream(archive.getRof(), startPos,
				startPos + unpPackedSize);
		subHead = hd;
		curUnpRead = 0;
		curPackWrite = 0;
		packedCRC = 0xFFffFFff;
	}

	public int unpRead(byte[] addr, int offset, int count) throws IOException,
			RarException {
		int retCode = 0, totalRead = 0;
		while (count > 0) {
			int readSize = (count > unpPackedSize) ? (int) unpPackedSize
					: count;
			retCode = inputStream.read(addr, offset, readSize);
			if (retCode < 0) {
				throw new EOFException();
			}
			if (subHead.isSplitAfter()) {
				packedCRC = RarCRC.checkCrc((int) packedCRC, addr, offset,
						retCode);
			}

			curUnpRead += retCode;
			totalRead += retCode;
			offset += retCode;
			count -= retCode;
			unpPackedSize -= retCode;
			archive.bytesReadRead(retCode);
			if (unpPackedSize == 0 && subHead.isSplitAfter()) {
				Volume nextVolume = archive.getVolumeManager().nextArchive(
						archive, archive.getVolume());
				if (nextVolume == null) {
					nextVolumeMissing = true;
					return -1;
				}

				FileHeader hd = this.getSubHeader();
				if (hd.getUnpVersion() >= 20 && hd.getFileCRC() != 0xffffffff
						&& this.getPackedCRC() != ~hd.getFileCRC()) {
					throw new RarException(RarExceptionType.crcError);
				}
				UnrarCallback callback = archive.getUnrarCallback();
				if ((callback != null)
						&& !callback.isNextVolumeReady(nextVolume)) {
					return -1;
				}
				archive.setVolume(nextVolume);
				hd = archive.nextFileHeader();
				if (hd == null) {
					return -1;
				}
				this.init(hd);
			} else {
				break;
			}
		}

		if (retCode != -1) {
			retCode = totalRead;
		}
		return retCode;

	}

	public void unpWrite(byte[] addr, int offset, int count) throws IOException {
		if (!testMode) {
			// DestFile->Write(Addr,Count);
			outputStream.write(addr, offset, count);
		}

		curUnpWrite += count;

		if (!skipUnpCRC) {
			if (archive.isOldFormat()) {
				unpFileCRC = RarCRC
						.checkOldCrc((short) unpFileCRC, addr, count);
			} else {
				unpFileCRC = RarCRC.checkCrc((int) unpFileCRC, addr, offset,
						count);
			}
		}
		// if (!skipArcCRC) {
		// archive.updateDataCRC(Addr, offset, ReadSize);
		// }
	}

	public void setPackedSizeToRead(long size) {
		unpPackedSize = size;
	}

	public void setTestMode(boolean mode) {
		testMode = mode;
	}

	public void setSkipUnpCRC(boolean skip) {
		skipUnpCRC = skip;
	}

	public void setSubHeader(FileHeader hd) {
		subHead = hd;

	}

	public long getCurPackRead() {
		return curPackRead;
	}

	public void setCurPackRead(long curPackRead) {
		this.curPackRead = curPackRead;
	}

	public long getCurPackWrite() {
		return curPackWrite;
	}

	public void setCurPackWrite(long curPackWrite) {
		this.curPackWrite = curPackWrite;
	}

	public long getCurUnpRead() {
		return curUnpRead;
	}

	public void setCurUnpRead(long curUnpRead) {
		this.curUnpRead = curUnpRead;
	}

	public long getCurUnpWrite() {
		return curUnpWrite;
	}

	public void setCurUnpWrite(long curUnpWrite) {
		this.curUnpWrite = curUnpWrite;
	}

	public int getDecryption() {
		return decryption;
	}

	public void setDecryption(int decryption) {
		this.decryption = decryption;
	}

	public int getEncryption() {
		return encryption;
	}

	public void setEncryption(int encryption) {
		this.encryption = encryption;
	}

	public boolean isNextVolumeMissing() {
		return nextVolumeMissing;
	}

	public void setNextVolumeMissing(boolean nextVolumeMissing) {
		this.nextVolumeMissing = nextVolumeMissing;
	}

	public long getPackedCRC() {
		return packedCRC;
	}

	public void setPackedCRC(long packedCRC) {
		this.packedCRC = packedCRC;
	}

	public long getPackFileCRC() {
		return packFileCRC;
	}

	public void setPackFileCRC(long packFileCRC) {
		this.packFileCRC = packFileCRC;
	}

	public boolean isPackVolume() {
		return packVolume;
	}

	public void setPackVolume(boolean packVolume) {
		this.packVolume = packVolume;
	}

	public long getProcessedArcSize() {
		return processedArcSize;
	}

	public void setProcessedArcSize(long processedArcSize) {
		this.processedArcSize = processedArcSize;
	}

	public long getTotalArcSize() {
		return totalArcSize;
	}

	public void setTotalArcSize(long totalArcSize) {
		this.totalArcSize = totalArcSize;
	}

	public long getTotalPackRead() {
		return totalPackRead;
	}

	public void setTotalPackRead(long totalPackRead) {
		this.totalPackRead = totalPackRead;
	}

	public long getUnpArcSize() {
		return unpArcSize;
	}

	public void setUnpArcSize(long unpArcSize) {
		this.unpArcSize = unpArcSize;
	}

	public long getUnpFileCRC() {
		return unpFileCRC;
	}

	public void setUnpFileCRC(long unpFileCRC) {
		this.unpFileCRC = unpFileCRC;
	}

	public boolean isUnpVolume() {
		return unpVolume;
	}

	public void setUnpVolume(boolean unpVolume) {
		this.unpVolume = unpVolume;
	}

	public FileHeader getSubHeader() {
		return subHead;
	}

	// public void setEncryption(int method, char[] Password, byte[] Salt,
	// boolean encrypt, boolean handsOffHash)
	// {
	//
	// }
	//
	// public void setAV15Encryption()
	// {
	//
	// }
	//
	// public void setCmt13Encryption()
	// {
	//
	// }
}


================================================
FILE: unrar/src/main/java/com/github/junrar/unpack/Unpack.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 31.05.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.unpack;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;

import com.github.junrar.exception.RarException;
import com.github.junrar.unpack.decode.Compress;
import com.github.junrar.unpack.ppm.BlockTypes;
import com.github.junrar.unpack.ppm.ModelPPM;
import com.github.junrar.unpack.ppm.SubAllocator;
import com.github.junrar.unpack.vm.BitInput;
import com.github.junrar.unpack.vm.RarVM;
import com.github.junrar.unpack.vm.VMPreparedProgram;


/**
 * DOCUMENT ME
 * 
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public final class Unpack extends Unpack20 {

    private final ModelPPM ppm = new ModelPPM();

    private int ppmEscChar;

    private RarVM rarVM = new RarVM();

    /* Filters code, one entry per filter */
    private List<UnpackFilter> filters = new ArrayList<UnpackFilter>();

    /* Filters stack, several entrances of same filter are possible */
    private List<UnpackFilter> prgStack = new ArrayList<UnpackFilter>();

    /*
     * lengths of preceding blocks, one length per filter. Used to reduce size
     * required to write block length if lengths are repeating
     */
    private List<Integer> oldFilterLengths = new ArrayList<Integer>();

    private int lastFilter;

    private boolean tablesRead;

    private byte[] unpOldTable = new byte[Compress.HUFF_TABLE_SIZE];

    private BlockTypes unpBlockType;

    private boolean externalWindow;

    private long writtenFileSize;

    private boolean fileExtracted;

    private boolean ppmError;

    private int prevLowDist;

    private int lowDistRepCount;

    public static int[] DBitLengthCounts = { 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
	    2, 2, 2, 2, 2, 14, 0, 12 };

    public Unpack(ComprDataIO DataIO) {
	unpIO = DataIO;
	window = null;
	externalWindow = false;
	suspended = false;
	unpAllBuf = false;
	unpSomeRead = false;
    }

    public void init(byte[] window) {
	if (window == null) {
	    this.window = new byte[Compress.MAXWINSIZE];
	} else {
	    this.window = window;
	    externalWindow = true;
	}
	inAddr = 0;
	unpInitData(false);
    }

    public void doUnpack(int method, boolean solid) throws IOException,
	    RarException {
	if (unpIO.getSubHeader().getUnpMethod() == 0x30) {
	    unstoreFile();
	}
	switch (method) {
	case 15: // rar 1.5 compression
	    unpack15(solid);
	    break;
	case 20: // rar 2.x compression
	case 26: // files larger than 2GB
	    unpack20(solid);
	    break;
	case 29: // rar 3.x compression
	case 36: // alternative hash
	    unpack29(solid);
	    break;
	}
    }

    private void unstoreFile() throws IOException, RarException {
	byte[] buffer = new byte[0x10000];
	while (true) {
	    int code = unpIO.unpRead(buffer, 0, (int) Math.min(buffer.length,
		    destUnpSize));
	    if (code == 0 || code == -1)
		break;
	    code = code < destUnpSize ? code : (int) destUnpSize;
	    unpIO.unpWrite(buffer, 0, code);
	    if (destUnpSize >= 0)
		destUnpSize -= code;
	}

    }

    private void unpack29(boolean solid) throws IOException, RarException {

	int[] DDecode = new int[Compress.DC];
	byte[] DBits = new byte[Compress.DC];

	int Bits;

	if (DDecode[1] == 0) {
	    int Dist = 0, BitLength = 0, Slot = 0;
	    for (int I = 0; I < DBitLengthCounts.length; I++, BitLength++) {
		int count = DBitLengthCounts[I];
		for (int J = 0; J < count; J++, Slot++, Dist += (1 << BitLength)) {
		    DDecode[Slot] = Dist;
		    DBits[Slot] = (byte) BitLength;
		}
	    }
	}

	fileExtracted = true;

	if (!suspended) {
	    unpInitData(solid);
	    if (!unpReadBuf()) {
		return;
	    }
	    if ((!solid || !tablesRead) && !readTables()) {
		return;
	    }
	}

	if (ppmError) {
	    return;
	}

	while (true) {
	    unpPtr &= Compress.MAXWINMASK;

	    if (inAddr > readBorder) {
		if (!unpReadBuf()) {
		    break;
		}
	    }
	    // System.out.println(((wrPtr - unpPtr) &
	    // Compress.MAXWINMASK)+":"+wrPtr+":"+unpPtr);
	    if (((wrPtr - unpPtr) & Compress.MAXWINMASK) < 260
		    && wrPtr != unpPtr) {

		UnpWriteBuf();
		if (writtenFileSize > destUnpSize) {
		    return;
		}
		if (suspended) {
		    fileExtracted = false;
		    return;
		}
	    }
	    if (unpBlockType == BlockTypes.BLOCK_PPM) {
		int Ch = ppm.decodeChar();
		if (Ch == -1) {
		    ppmError = true;
		    break;
		}
		if (Ch == ppmEscChar) {
		    int NextCh = ppm.decodeChar();
		    if (NextCh == 0) {
			if (!readTables()) {
			    break;
			}
			continue;
		    }
		    if (NextCh == 2 || NextCh == -1) {
			break;
		    }
		    if (NextCh == 3) {
			if (!readVMCodePPM()) {
			    break;
			}
			continue;
		    }
		    if (NextCh == 4) {
			int Distance = 0, Length = 0;
			boolean failed = false;
			for (int I = 0; I < 4 && !failed; I++) {
			    int ch = ppm.decodeChar();
			    if (ch == -1) {
				failed = true;
			    } else {
				if (I == 3) {
				    // Bug fixed
				    Length = ch & 0xff;
				} else {
				    // Bug fixed
				    Distance = (Distance << 8) + (ch & 0xff);
				}
			    }
			}
			if (failed) {
			    break;
			}
			copyString(Length + 32, Distance + 2);
			continue;
		    }
		    if (NextCh == 5) {
			int Length = ppm.decodeChar();
			if (Length == -1) {
			    break;
			}
			copyString(Length + 4, 1);
			continue;
		    }
		}
		window[unpPtr++] = (byte) Ch;
		continue;
	    }

	    int Number = decodeNumber(LD);
	    if (Number < 256) {
		window[unpPtr++] = (byte) Number;
		continue;
	    }
	    if (Number >= 271) {
		int Length = LDecode[Number -= 271] + 3;
		if ((Bits = LBits[Number]) > 0) {
		    Length += getbits() >>> (16 - Bits);
		    addbits(Bits);
		}

		int DistNumber = decodeNumber(DD);
		int Distance = DDecode[DistNumber] + 1;
		if ((Bits = DBits[DistNumber]) > 0) {
		    if (DistNumber > 9) {
			if (Bits > 4) {
			    Distance += ((getbits() >>> (20 - Bits)) << 4);
			    addbits(Bits - 4);
			}
			if (lowDistRepCount > 0) {
			    lowDistRepCount--;
			    Distance += prevLowDist;
			} else {
			    int LowDist = decodeNumber(LDD);
			    if (LowDist == 16) {
				lowDistRepCount = Compress.LOW_DIST_REP_COUNT - 1;
				Distance += prevLowDist;
			    } else {
				Distance += LowDist;
				prevLowDist = LowDist;
			    }
			}
		    } else {
			Distance += getbits() >>> (16 - Bits);
			addbits(Bits);
		    }
		}

		if (Distance >= 0x2000) {
		    Length++;
		    if (Distance >= 0x40000L) {
			Length++;
		    }
		}

		insertOldDist(Distance);
		insertLastMatch(Length, Distance);

		copyString(Length, Distance);
		continue;
	    }
	    if (Number == 256) {
		if (!readEndOfBlock()) {
		    break;
		}
		continue;
	    }
	    if (Number == 257) {
		if (!readVMCode()) {
		    break;
		}
		continue;
	    }
	    if (Number == 258) {
		if (lastLength != 0) {
		    copyString(lastLength, lastDist);
		}
		continue;
	    }
	    if (Number < 263) {
		int DistNum = Number - 259;
		int Distance = oldDist[DistNum];
		for (int I = DistNum; I > 0; I--) {
		    oldDist[I] = oldDist[I - 1];
		}
		oldDist[0] = Distance;

		int LengthNumber = decodeNumber(RD);
		int Length = LDecode[LengthNumber] + 2;
		if ((Bits = LBits[LengthNumber]) > 0) {
		    Length += getbits() >>> (16 - Bits);
		    addbits(Bits);
		}
		insertLastMatch(Length, Distance);
		copyString(Length, Distance);
		continue;
	    }
	    if (Number < 272) {
		int Distance = SDDecode[Number -= 263] + 1;
		if ((Bits = SDBits[Number]) > 0) {
		    Distance += getbits() >>> (16 - Bits);
		    addbits(Bits);
		}
		insertOldDist(Distance);
		insertLastMatch(2, Distance);
		copyString(2, Distance);
		continue;
	    }
	}
	UnpWriteBuf();

    }

    private void UnpWriteBuf() throws IOException {
	int WrittenBorder = wrPtr;
	int WriteSize = (unpPtr - WrittenBorder) & Compress.MAXWINMASK;
	for (int I = 0; I < prgStack.size(); I++) {
	    UnpackFilter flt = prgStack.get(I);
	    if (flt == null) {
		continue;
	    }
	    if (flt.isNextWindow()) {
		flt.setNextWindow(false);// ->NextWindow=false;
		continue;
	    }
	    int BlockStart = flt.getBlockStart();// ->BlockStart;
	    int BlockLength = flt.getBlockLength();// ->BlockLength;
	    if (((BlockStart - WrittenBorder) & Compress.MAXWINMASK) < WriteSize) {
		if (WrittenBorder != BlockStart) {
		    UnpWriteArea(WrittenBorder, BlockStart);
		    WrittenBorder = BlockStart;
		    WriteSize = (unpPtr - WrittenBorder) & Compress.MAXWINMASK;
		}
		if (BlockLength <= WriteSize) {
		    int BlockEnd = (BlockStart + BlockLength)
			    & Compress.MAXWINMASK;
		    if (BlockStart < BlockEnd || BlockEnd == 0) {
			// VM.SetMemory(0,Window+BlockStart,BlockLength);
			rarVM.setMemory(0, window, BlockStart, BlockLength);
		    } else {
			int FirstPartLength = Compress.MAXWINSIZE - BlockStart;
			// VM.SetMemory(0,Window+BlockStart,FirstPartLength);
			rarVM.setMemory(0, window, BlockStart, FirstPartLength);
			// VM.SetMemory(FirstPartLength,Window,BlockEnd);
			rarVM.setMemory(FirstPartLength, window, 0, BlockEnd);

		    }

		    VMPreparedProgram ParentPrg = filters.get(
			    flt.getParentFilter()).getPrg();
		    VMPreparedProgram Prg = flt.getPrg();

		    if (ParentPrg.getGlobalData().size() > RarVM.VM_FIXEDGLOBALSIZE) {
			// copy global data from previous script execution if
			// any
			// Prg->GlobalData.Alloc(ParentPrg->GlobalData.Size());
			// memcpy(&Prg->GlobalData[VM_FIXEDGLOBALSIZE],&ParentPrg->GlobalData[VM_FIXEDGLOBALSIZE],ParentPrg->GlobalData.Size()-VM_FIXEDGLOBALSIZE);
			Prg.getGlobalData().setSize(
				ParentPrg.getGlobalData().size());
			for (int i = 0; i < ParentPrg.getGlobalData().size()
				- RarVM.VM_FIXEDGLOBALSIZE; i++) {
			    Prg.getGlobalData().set(
				    RarVM.VM_FIXEDGLOBALSIZE + i,
				    ParentPrg.getGlobalData().get(
					    RarVM.VM_FIXEDGLOBALSIZE + i));
			}
		    }

		    ExecuteCode(Prg);

		    if (Prg.getGlobalData().size() > RarVM.VM_FIXEDGLOBALSIZE) {
			// save global data for next script execution
			if (ParentPrg.getGlobalData().size() < Prg
				.getGlobalData().size()) {
			    ParentPrg.getGlobalData().setSize(
				    Prg.getGlobalData().size());// ->GlobalData.Alloc(Prg->GlobalData.Size());
			}
			// memcpy(&ParentPrg->GlobalData[VM_FIXEDGLOBALSIZE],&Prg->GlobalData[VM_FIXEDGLOBALSIZE],Prg->GlobalData.Size()-VM_FIXEDGLOBALSIZE);
			for (int i = 0; i < Prg.getGlobalData().size()
				- RarVM.VM_FIXEDGLOBALSIZE; i++) {
			    ParentPrg.getGlobalData().set(
				    RarVM.VM_FIXEDGLOBALSIZE + i,
				    Prg.getGlobalData().get(
					    RarVM.VM_FIXEDGLOBALSIZE + i));
			}
		    } else {
			ParentPrg.getGlobalData().clear();
		    }

		    int FilteredDataOffset = Prg.getFilteredDataOffset();
		    int FilteredDataSize = Prg.getFilteredDataSize();
		    byte[] FilteredData = new byte[FilteredDataSize];

		    for (int i = 0; i < FilteredDataSize; i++) {
			FilteredData[i] = rarVM.getMem()[FilteredDataOffset + i];// Prg.getGlobalData().get(FilteredDataOffset
										 // +
										 // i);
		    }

		    prgStack.set(I, null);
		    while (I + 1 < prgStack.size()) {
			UnpackFilter NextFilter = prgStack.get(I + 1);
			if (NextFilter == null
				|| NextFilter.getBlockStart() != BlockStart
				|| NextFilter.getBlockLength() != FilteredDataSize
				|| NextFilter.isNextWindow()) {
			    break;
			}
			// apply several filters to same data block

			rarVM.setMemory(0, FilteredData, 0, FilteredDataSize);// .SetMemory(0,FilteredData,FilteredDataSize);

			VMPreparedProgram pPrg = filters.get(
				NextFilter.getParentFilter()).getPrg();
			VMPreparedProgram NextPrg = NextFilter.getPrg();

			if (pPrg.getGlobalData().size() > RarVM.VM_FIXEDGLOBALSIZE) {
			    // copy global data from previous script execution
			    // if any
			    // NextPrg->GlobalData.Alloc(ParentPrg->GlobalData.Size());
			    NextPrg.getGlobalData().setSize(
				    pPrg.getGlobalData().size());
			    // memcpy(&NextPrg->GlobalData[VM_FIXEDGLOBALSIZE],&ParentPrg->GlobalData[VM_FIXEDGLOBALSIZE],ParentPrg->GlobalData.Size()-VM_FIXEDGLOBALSIZE);
			    for (int i = 0; i < pPrg.getGlobalData().size()
				    - RarVM.VM_FIXEDGLOBALSIZE; i++) {
				NextPrg.getGlobalData().set(
					RarVM.VM_FIXEDGLOBALSIZE + i,
					pPrg.getGlobalData().get(
						RarVM.VM_FIXEDGLOBALSIZE + i));
			    }
			}

			ExecuteCode(NextPrg);

			if (NextPrg.getGlobalData().size() > RarVM.VM_FIXEDGLOBALSIZE) {
			    // save global data for next script execution
			    if (pPrg.getGlobalData().size() < NextPrg
				    .getGlobalData().size()) {
				pPrg.getGlobalData().setSize(
					NextPrg.getGlobalData().size());
			    }
			    // memcpy(&ParentPrg->GlobalData[VM_FIXEDGLOBALSIZE],&NextPrg->GlobalData[VM_FIXEDGLOBALSIZE],NextPrg->GlobalData.Size()-VM_FIXEDGLOBALSIZE);
			    for (int i = 0; i < NextPrg.getGlobalData().size()
				    - RarVM.VM_FIXEDGLOBALSIZE; i++) {
				pPrg.getGlobalData().set(
					RarVM.VM_FIXEDGLOBALSIZE + i,
					NextPrg.getGlobalData().get(
						RarVM.VM_FIXEDGLOBALSIZE + i));
			    }
			} else {
			    pPrg.getGlobalData().clear();
			}
			FilteredDataOffset = NextPrg.getFilteredDataOffset();
			FilteredDataSize = NextPrg.getFilteredDataSize();

			FilteredData = new byte[FilteredDataSize];
			for (int i = 0; i < FilteredDataSize; i++) {
			    FilteredData[i] = NextPrg.getGlobalData().get(
				    FilteredDataOffset + i);
			}

			I++;
			prgStack.set(I, null);
		    }
		    unpIO.unpWrite(FilteredData, 0, FilteredDataSize);
		    unpSomeRead = true;
		    writtenFileSize += FilteredDataSize;
		    WrittenBorder = BlockEnd;
		    WriteSize = (unpPtr - WrittenBorder) & Compress.MAXWINMASK;
		} else {
		    for (int J = I; J < prgStack.size(); J++) {
			UnpackFilter filt = prgStack.get(J);
			if (filt != null && filt.isNextWindow()) {
			    filt.setNextWindow(false);
			}
		    }
		    wrPtr = WrittenBorder;
		    return;
		}
	    }
	}

	UnpWriteArea(WrittenBorder, unpPtr);
	wrPtr = unpPtr;

    }

    private void UnpWriteArea(int startPtr, int endPtr) throws IOException {
	if (endPtr != startPtr) {
	    unpSomeRead = true;
	}
	if (endPtr < startPtr) {
	    UnpWriteData(window, startPtr, -startPtr & Compress.MAXWINMASK);
	    UnpWriteData(window, 0, endPtr);
	    unpAllBuf = true;
	} else {
	    UnpWriteData(window, startPtr, endPtr - startPtr);
	}
    }

    private void UnpWriteData(byte[] data, int offset, int size)
	    throws IOException {
	if (writtenFileSize >= destUnpSize) {
	    return;
	}
	int writeSize = size;
	long leftToWrite = destUnpSize - writtenFileSize;
	if (writeSize > leftToWrite) {
	    writeSize = (int) leftToWrite;
	}
	unpIO.unpWrite(data, offset, writeSize);

	writtenFileSize += size;

    }

    private void insertOldDist(int distance) {
	oldDist[3] = oldDist[2];
	oldDist[2] = oldDist[1];
	oldDist[1] = oldDist[0];
	oldDist[0] = distance;
    }

    private void insertLastMatch(int length, int distance) {
	lastDist = distance;
	lastLength = length;
    }

    private void copyString(int length, int distance) {
	// System.out.println("copyString(" + length + ", " + distance + ")");

	int destPtr = unpPtr - distance;
	// System.out.println(unpPtr+":"+distance);
	if (destPtr >= 0 && destPtr < Compress.MAXWINSIZE - 260
		&& unpPtr < Compress.MAXWINSIZE - 260) {

	    window[unpPtr++] = window[destPtr++];

	    while (--length > 0)

		window[unpPtr++] = window[destPtr++];
	} else
	    while (length-- != 0) {
		window[unpPtr] = window[destPtr++ & Compress.MAXWINMASK];
		unpPtr = (unpPtr + 1) & Compress.MAXWINMASK;
	    }
    }

    protected void unpInitData(boolean solid) {
	if (!solid) {
	    tablesRead = false;
	    Arrays.fill(oldDist, 0); // memset(oldDist,0,sizeof(OldDist));

	    oldDistPtr = 0;
	    lastDist = 0;
	    lastLength = 0;

	    Arrays.fill(unpOldTable, (byte) 0);// memset(UnpOldTable,0,sizeof(UnpOldTable));

	    unpPtr = 0;
	    wrPtr = 0;
	    ppmEscChar = 2;

	    initFilters();
	}
	InitBitInput();
	ppmError = false;
	writtenFileSize = 0;
	readTop = 0;
	readBorder = 0;
	unpInitData20(solid);
    }

    private void initFilters() {
	oldFilterLengths.clear();
	lastFilter = 0;

	filters.clear();

	prgStack.clear();
    }

    private boolean readEndOfBlock() throws IOException, RarException {
	int BitField = getbits();
	boolean NewTable, NewFile = false;
	if ((BitField & 0x8000) != 0) {
	    NewTable = true;
	    addbits(1);
	} else {
	    NewFile = true;
	    NewTable = (BitField & 0x4000) != 0 ? true : false;
	    addbits(2);
	}
	tablesRead = !NewTable;
	return !(NewFile || NewTable && !readTables());
    }

    private boolean readTables() throws IOException, RarException {
	byte[] bitLength = new byte[Compress.BC];

	byte[] table = new byte[Compress.HUFF_TABLE_SIZE];
	if (inAddr > readTop - 25) {
	    if (!unpReadBuf()) {
		return (false);
	    }
	}
	faddbits((8 - inBit) & 7);
	long bitField = fgetbits() & 0xffFFffFF;
	if ((bitField & 0x8000) != 0) {
	    unpBlockType = BlockTypes.BLOCK_PPM;
	    return (ppm.decodeInit(this, ppmEscChar));
	}
	unpBlockType = BlockTypes.BLOCK_LZ;

	prevLowDist = 0;
	lowDistRepCount = 0;

	if ((bitField & 0x4000) == 0) {
	    Arrays.fill(unpOldTable, (byte) 0);// memset(UnpOldTable,0,sizeof(UnpOldTable));
	}
	faddbits(2);

	for (int i = 0; i < Compress.BC; i++) {
	    int length = (fgetbits() >>> 12) & 0xFF;
	    faddbits(4);
	    if (length == 15) {
		int zeroCount = (fgetbits() >>> 12) & 0xFF;
		faddbits(4);
		if (zeroCount == 0) {
		    bitLength[i] = 15;
		} else {
		    zeroCount += 2;
		    while (zeroCount-- > 0 && i < bitLength.length) {
			bitLength[i++] = 0;
		    }
		    i--;
		}
	    } else {
		bitLength[i] = (byte) length;
	    }
	}

	makeDecodeTables(bitLength, 0, BD, Compress.BC);

	int TableSize = Compress.HUFF_TABLE_SIZE;

	for (int i = 0; i < TableSize;) {
	    if (inAddr > readTop - 5) {
		if (!unpReadBuf()) {
		    return (false);
		}
	    }
	    int Number = decodeNumber(BD);
	    if (Number < 16) {
		table[i] = (byte) ((Number + unpOldTable[i]) & 0xf);
		i++;
	    } else if (Number < 18) {
		int N;
		if (Number == 16) {
		    N = (fgetbits() >>> 13) + 3;
		    faddbits(3);
		} else {
		    N = (fgetbits() >>> 9) + 11;
		    faddbits(7);
		}
		while (N-- > 0 && i < TableSize) {
		    table[i] = table[i - 1];
		    i++;
		}
	    } else {
		int N;
		if (Number == 18) {
		    N = (fgetbits() >>> 13) + 3;
		    faddbits(3);
		} else {
		    N = (fgetbits() >>> 9) + 11;
		    faddbits(7);
		}
		while (N-- > 0 && i < TableSize) {
		    table[i++] = 0;
		}
	    }
	}
	tablesRead = true;
	if (inAddr > readTop) {
	    return (false);
	}
	makeDecodeTables(table, 0, LD, Compress.NC);
	makeDecodeTables(table, Compress.NC, DD, Compress.DC);
	makeDecodeTables(table, Compress.NC + Compress.DC, LDD, Compress.LDC);
	makeDecodeTables(table, Compress.NC + Compress.DC + Compress.LDC, RD,
		Compress.RC);

	// memcpy(unpOldTable,table,sizeof(unpOldTable));
	for (int i = 0; i < unpOldTable.length; i++) {
	    unpOldTable[i] = table[i];
	}
	return (true);

    }

    private boolean readVMCode() throws IOException, RarException {
	int FirstByte = getbits() >> 8;
	addbits(8);
	int Length = (FirstByte & 7) + 1;
	if (Length == 7) {
	    Length = (getbits() >> 8) + 7;
	    addbits(8);
	} else if (Length == 8) {
	    Length = getbits();
	    addbits(16);
	}
	List<Byte> vmCode = new ArrayList<Byte>();
	for (int I = 0; I < Length; I++) {
	    if (inAddr >= readTop - 1 && !unpReadBuf() && I < Length - 1) {
		return (false);
	    }
	    vmCode.add(Byte.valueOf((byte) (getbits() >> 8)));
	    addbits(8);
	}
	return (addVMCode(FirstByte, vmCode, Length));
    }

    private boolean readVMCodePPM() throws IOException, RarException {
	int FirstByte = ppm.decodeChar();
	if ((int) FirstByte == -1) {
	    return (false);
	}
	int Length = (FirstByte & 7) + 1;
	if (Length == 7) {
	    int B1 = ppm.decodeChar();
	    if (B1 == -1) {
		return (false);
	    }
	    Length = B1 + 7;
	} else if (Length == 8) {
	    int B1 = ppm.decodeChar();
	    if (B1 == -1) {
		return (false);
	    }
	    int B2 = ppm.decodeChar();
	    if (B2 == -1) {
		return (false);
	    }
	    Length = B1 * 256 + B2;
	}
	List<Byte> vmCode = new ArrayList<Byte>();
	for (int I = 0; I < Length; I++) {
	    int Ch = ppm.decodeChar();
	    if (Ch == -1) {
		return (false);
	    }
	    vmCode.add(Byte.valueOf((byte) Ch));// VMCode[I]=Ch;
	}
	return (addVMCode(FirstByte, vmCode, Length));
    }

    private boolean addVMCode(int firstByte, List<Byte> vmCode, int length) {
	BitInput Inp = new BitInput();
	Inp.InitBitInput();
	// memcpy(Inp.InBuf,Code,Min(BitInput::MAX_SIZE,CodeSize));
	for (int i = 0; i < Math.min(BitInput.MAX_SIZE, vmCode.size()); i++) {
	    Inp.getInBuf()[i] = vmCode.get(i);
	}
	rarVM.init();

	int FiltPos;
	if ((firstByte & 0x80) != 0) {
	    FiltPos = RarVM.ReadData(Inp);
	    if (FiltPos == 0) {
		initFilters();
	    } else {
		FiltPos--;
	    }
	} else
	    FiltPos = lastFilter; // use the same filter as last time

	if (FiltPos > filters.size() || FiltPos > oldFilterLengths.size()) {
	    return (false);
	}
	lastFilter = FiltPos;
	boolean NewFilter = (FiltPos == filters.size());

	UnpackFilter StackFilter = new UnpackFilter(); // new filter for
	// PrgStack

	UnpackFilter Filter;
	if (NewFilter) // new filter code, never used before since VM reset
	{
	    // too many different filters, corrupt archive
	    if (FiltPos > 1024) {
		return (false);
	    }

	    // Filters[Filters.Size()-1]=Filter=new UnpackFilter;
	    Filter = new UnpackFilter();
	    filters.add(Filter);
	    StackFilter.setParentFilter(filters.size() - 1);
	    oldFilterLengths.add(0);
	    Filter.setExecCount(0);
	} else // filter was used in the past
	{
	    Filter = filters.get(FiltPos);
	    StackFilter.setParentFilter(FiltPos);
	    Filter.setExecCount(Filter.getExecCount() + 1);// ->ExecCount++;
	}

	prgStack.add(StackFilter);
	StackFilter.setExecCount(Filter.getExecCount());// ->ExecCount;

	int BlockStart = RarVM.ReadData(Inp);
	if ((firstByte & 0x40) != 0) {
	    BlockStart += 258;
	}
	StackFilter.setBlockStart((BlockStart + unpPtr) & Compress.MAXWINMASK);
	if ((firstByte & 0x20) != 0) {
	    StackFilter.setBlockLength(RarVM.ReadData(Inp));
	} else {
	    StackFilter
		    .setBlockLength(FiltPos < oldFilterLengths.size() ? oldFilterLengths
			    .get(FiltPos)
			    : 0);
	}
	StackFilter.setNextWindow((wrPtr != unpPtr)
		&& ((wrPtr - unpPtr) & Compress.MAXWINMASK) <= BlockStart);

	// DebugLog("\nNextWindow: UnpPtr=%08x WrPtr=%08x
	// BlockStart=%08x",UnpPtr,WrPtr,BlockStart);

	oldFilterLengths.set(FiltPos, StackFilter.getBlockLength());

	// memset(StackFilter->Prg.InitR,0,sizeof(StackFilter->Prg.InitR));
	Arrays.fill(StackFilter.getPrg().getInitR(), 0);
	StackFilter.getPrg().getInitR()[3] = RarVM.VM_GLOBALMEMADDR;// StackFilter->Prg.InitR[3]=VM_GLOBALMEMADDR;
	StackFilter.getPrg().getInitR()[4] = StackFilter.getBlockLength();// StackFilter->Prg.InitR[4]=StackFilter->BlockLength;
	StackFilter.getPrg().getInitR()[5] = StackFilter.getExecCount();// StackFilter->Prg.InitR[5]=StackFilter->ExecCount;

	if ((firstByte & 0x10) != 0) // set registers to optional parameters
	// if any
	{
	    int InitMask = Inp.fgetbits() >>> 9;
	    Inp.faddbits(7);
	    for (int I = 0; I < 7; I++) {
		if ((InitMask & (1 << I)) != 0) {
		    // StackFilter->Prg.InitR[I]=RarVM::ReadData(Inp);
		    StackFilter.getPrg().getInitR()[I] = RarVM.ReadData(Inp);
		}
	    }
	}

	if (NewFilter) {
	    int VMCodeSize = RarVM.ReadData(Inp);
	    if (VMCodeSize >= 0x10000 || VMCodeSize == 0) {
		return (false);
	    }
	    byte[] VMCode = new byte[VMCodeSize];
	    for (int I = 0; I < VMCodeSize; I++) {
		if (Inp.Overflow(3)) {
		    return (false);
		}
		VMCode[I] = (byte) (Inp.fgetbits() >> 8);
		Inp.faddbits(8);
	    }
	    // VM.Prepare(&VMCode[0],VMCodeSize,&Filter->Prg);
	    rarVM.prepare(VMCode, VMCodeSize, Filter.getPrg());
	}
	StackFilter.getPrg().setAltCmd(Filter.getPrg().getCmd());// StackFilter->Prg.AltCmd=&Filter->Prg.Cmd[0];
	StackFilter.getPrg().setCmdCount(Filter.getPrg().getCmdCount());// StackFilter->Prg.CmdCount=Filter->Prg.CmdCount;

	int StaticDataSize = Filter.getPrg().getStaticData().size();
	if (StaticDataSize > 0 && StaticDataSize < RarVM.VM_GLOBALMEMSIZE) {
	    // read statically defined data contained in DB commands
	    // StackFilter->Prg.StaticData.Add(StaticDataSize);
	    StackFilter.getPrg().setStaticData(Filter.getPrg().getStaticData());
	    // memcpy(&StackFilter->Prg.StaticData[0],&Filter->Prg.StaticData[0],StaticDataSize);
	}

	if (StackFilter.getPrg().getGlobalData().size() < RarVM.VM_FIXEDGLOBALSIZE) {
	    // StackFilter->Prg.GlobalData.Reset();
	    // StackFilter->Prg.GlobalData.Add(VM_FIXEDGLOBALSIZE);
	    StackFilter.getPrg().getGlobalData().clear();
	    StackFilter.getPrg().getGlobalData().setSize(
		    RarVM.VM_FIXEDGLOBALSIZE);
	}

	// byte *GlobalData=&StackFilter->Prg.GlobalData[0];
	Vector<Byte> globalData = StackFilter.getPrg().getGlobalData();
	for (int I = 0; I < 7; I++) {
	    rarVM.setLowEndianValue(globalData, I * 4, StackFilter.getPrg()
		    .getInitR()[I]);
	}

	// VM.SetLowEndianValue((uint
	// *)&GlobalData[0x1c],StackFilter->BlockLength);
	rarVM.setLowEndianValue(globalData, 0x1c, StackFilter.getBlockLength());
	// VM.SetLowEndianValue((uint *)&GlobalData[0x20],0);
	rarVM.setLowEndianValue(globalData, 0x20, 0);
	rarVM.setLowEndianValue(globalData, 0x24, 0);
	rarVM.setLowEndianValue(globalData, 0x28, 0);

	// VM.SetLowEndianValue((uint
	// *)&GlobalData[0x2c],StackFilter->ExecCount);
	rarVM.setLowEndianValue(globalData, 0x2c, StackFilter.getExecCount());
	// memset(&GlobalData[0x30],0,16);
	for (int i = 0; i < 16; i++) {
	    globalData.set(0x30 + i, Byte.valueOf((byte) (0)));
	}
	if ((firstByte & 8) != 0) // put data block passed as parameter if any
	{
	    if (Inp.Overflow(3)) {
		return (false);
	    }
	    int DataSize = RarVM.ReadData(Inp);
	    if (DataSize > RarVM.VM_GLOBALMEMSIZE - RarVM.VM_FIXEDGLOBALSIZE) {
		return (false);
	    }
	    int CurSize = StackFilter.getPrg().getGlobalData().size();
	    if (CurSize < DataSize + RarVM.VM_FIXEDGLOBALSIZE) {
		// StackFilter->Prg.GlobalData.Add(DataSize+VM_FIXEDGLOBALSIZE-CurSize);
		StackFilter.getPrg().getGlobalData().setSize(
			DataSize + RarVM.VM_FIXEDGLOBALSIZE - CurSize);
	    }
	    int offset = RarVM.VM_FIXEDGLOBALSIZE;
	    globalData = StackFilter.getPrg().getGlobalData();
	    for (int I = 0; I < DataSize; I++) {
		if (Inp.Overflow(3)) {
		    return (false);
		}
		globalData.set(offset + I, Byte
			.valueOf((byte) (Inp.fgetbits() >>> 8)));
		Inp.faddbits(8);
	    }
	}
	return (true);
    }

    private void ExecuteCode(VMPreparedProgram Prg) {
	if (Prg.getGlobalData().size() > 0) {
	    // Prg->InitR[6]=int64to32(WrittenFileSize);
	    Prg.getInitR()[6] = (int) (writtenFileSize);
	    // rarVM.SetLowEndianValue((uint
	    // *)&Prg->GlobalData[0x24],int64to32(WrittenFileSize));
	    rarVM.setLowEndianValue(Prg.getGlobalData(), 0x24,
		    (int) writtenFileSize);
	    // rarVM.SetLowEndianValue((uint
	    // *)&Prg->GlobalData[0x28],int64to32(WrittenFileSize>>32));
	    rarVM.setLowEndianValue(Prg.getGlobalData(), 0x28,
		    (int) (writtenFileSize >>> 32));
	    rarVM.execute(Prg);
	}
    }

    // Duplicate method
    // private boolean ReadEndOfBlock() throws IOException, RarException
    // {
    // int BitField = getbits();
    // boolean NewTable, NewFile = false;
    // if ((BitField & 0x8000) != 0) {
    // NewTable = true;
    // addbits(1);
    // } else {
    // NewFile = true;
    // NewTable = (BitField & 0x4000) != 0;
    // addbits(2);
    // }
    // tablesRead = !NewTable;
    // return !(NewFile || NewTable && !readTables());
    // }

    public boolean isFileExtracted() {
	return fileExtracted;
    }

    public void setDestSize(long destSize) {
	this.destUnpSize = destSize;
	this.fileExtracted = false;
    }

    public void setSuspended(boolean suspended) {
	this.suspended = suspended;
    }

    public int getChar() throws IOException, RarException {
	if (inAddr > BitInput.MAX_SIZE - 30) {
	    unpReadBuf();
	}
	return (inBuf[inAddr++] & 0xff);
    }

    public int getPpmEscChar() {
	return ppmEscChar;
    }

    public void setPpmEscChar(int ppmEscChar) {
	this.ppmEscChar = ppmEscChar;
    }

    public void cleanUp() {
	if (ppm != null) {
	    SubAllocator allocator = ppm.getSubAlloc();
	    if (allocator != null) {
		allocator.stopSubAllocator();
	    }
	}
    }
}


================================================
FILE: unrar/src/main/java/com/github/junrar/unpack/Unpack15.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 21.06.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.unpack;

import java.io.IOException;
import java.util.Arrays;

import com.github.junrar.exception.RarException;
import com.github.junrar.unpack.decode.Compress;
import com.github.junrar.unpack.vm.BitInput;


/**
 * DOCUMENT ME
 * 
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public abstract class Unpack15 extends BitInput
{

	protected int readBorder;
	
	protected boolean suspended;

	protected boolean unpAllBuf;

	protected ComprDataIO unpIO;

	protected boolean unpSomeRead;

	protected int readTop;

	protected long destUnpSize;

	protected byte[] window;

	protected int[] oldDist = new int[4];

	protected int unpPtr, wrPtr;

	protected int oldDistPtr;

	protected int[] ChSet = new int[256], ChSetA = new int[256],
			ChSetB = new int[256], ChSetC = new int[256];

	protected int[] Place = new int[256], PlaceA = new int[256],
			PlaceB = new int[256], PlaceC = new int[256];

	protected int[] NToPl = new int[256], NToPlB = new int[256],
			NToPlC = new int[256];

	protected int FlagBuf, AvrPlc, AvrPlcB, AvrLn1, AvrLn2, AvrLn3;

	protected int Buf60, NumHuf, StMode, LCount, FlagsCnt;

	protected int Nhfb, Nlzb, MaxDist3;

	protected int lastDist, lastLength;

	private static final int STARTL1 = 2;

	private static int DecL1[] = { 0x8000, 0xa000, 0xc000, 0xd000, 0xe000,
			0xea00, 0xee00, 0xf000, 0xf200, 0xf200, 0xffff };

	private static int PosL1[] = { 0, 0, 0, 2, 3, 5, 7, 11, 16, 20, 24, 32, 32 };

	private static final int STARTL2 = 3;

	private static int DecL2[] = { 0xa000, 0xc000, 0xd000, 0xe000, 0xea00,
			0xee00, 0xf000, 0xf200, 0xf240, 0xffff };

	private static int PosL2[] = { 0, 0, 0, 0, 5, 7, 9, 13, 18, 22, 26, 34, 36 };

	private static final int STARTHF0 = 4;

	private static int DecHf0[] = { 0x8000, 0xc000, 0xe000, 0xf200, 0xf200,
			0xf200, 0xf200, 0xf200, 0xffff };

	private static int PosHf0[] = { 0, 0, 0, 0, 0, 8, 16, 24, 33, 33, 33, 33,
			33 };

	private static final int STARTHF1 = 5;

	private static int DecHf1[] = { 0x2000, 0xc000, 0xe000, 0xf000, 0xf200,
			0xf200, 0xf7e0, 0xffff };

	private static int PosHf1[] = { 0, 0, 0, 0, 0, 0, 4, 44, 60, 76, 80, 80,
			127 };

	private static final int STARTHF2 = 5;

	private static int DecHf2[] = { 0x1000, 0x2400, 0x8000, 0xc000, 0xfa00,
			0xffff, 0xffff, 0xffff };

	private static int PosHf2[] = { 0, 0, 0, 0, 0, 0, 2, 7, 53, 117, 233, 0, 0 };

	private static final int STARTHF3 = 6;

	private static int DecHf3[] = { 0x800, 0x2400, 0xee00, 0xfe80, 0xffff,
			0xffff, 0xffff };

	private static int PosHf3[] = { 0, 0, 0, 0, 0, 0, 0, 2, 16, 218, 251, 0, 0 };

	private static final int STARTHF4 = 8;

	private static int DecHf4[] = { 0xff00, 0xffff, 0xffff, 0xffff, 0xffff,
			0xffff };

	private static int PosHf4[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0 };

	static int ShortLen1[] = { 1, 3, 4, 4, 5, 6, 7, 8, 8, 4, 4, 5, 6, 6, 4, 0 };

	static int ShortXor1[] = { 0, 0xa0, 0xd0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe,
			0xff, 0xc0, 0x80, 0x90, 0x98, 0x9c, 0xb0 };

	static int ShortLen2[] = { 2, 3, 3, 3, 4, 4, 5, 6, 6, 4, 4, 5, 6, 6, 4, 0 };

	static int ShortXor2[] = { 0, 0x40, 0x60, 0xa0, 0xd0, 0xe0, 0xf0, 0xf8,
			0xfc, 0xc0, 0x80, 0x90, 0x98, 0x9c, 0xb0 };

	protected abstract void unpInitData(boolean solid);

	protected void unpack15(boolean solid) throws IOException, RarException
	{
		if (suspended) {
			unpPtr = wrPtr;
		} else {
			unpInitData(solid);
			oldUnpInitData(solid);
			unpReadBuf();
			if (!solid) {
				initHuff();
				unpPtr = 0;
			} else {
				unpPtr = wrPtr;
			}
			--destUnpSize;
		}
		if (destUnpSize >= 0) {
			getFlagsBuf();
			FlagsCnt = 8;
		}

		while (destUnpSize >= 0) {
			unpPtr &= Compress.MAXWINMASK;

			if (inAddr > readTop - 30 && !unpReadBuf()) {
				break;
			}
			if (((wrPtr - unpPtr) & Compress.MAXWINMASK) < 270
					&& wrPtr != unpPtr) {
				oldUnpWriteBuf();
				if (suspended) {
					return;
				}
			}
			if (StMode != 0) {
				huffDecode();
				continue;
			}

			if (--FlagsCnt < 0) {
				getFlagsBuf();
				FlagsCnt = 7;
			}

			if ((FlagBuf & 0x80) != 0) {
				FlagBuf <<= 1;
				if (Nlzb > Nhfb) {
					longLZ();
				} else {
					huffDecode();
				}
			} else {
				FlagBuf <<= 1;
				if (--FlagsCnt < 0) {
					getFlagsBuf();
					FlagsCnt = 7;
				}
				if ((FlagBuf & 0x80) != 0) {
					FlagBuf <<= 1;
					if (Nlzb > Nhfb) {
						huffDecode();
					} else {
						longLZ();
					}
				} else {
					FlagBuf <<= 1;
					shortLZ();
				}
			}
		}
		oldUnpWriteBuf();
	}



	protected boolean unpReadBuf() throws IOException, RarException
	{
		  int dataSize=readTop-inAddr;
		  if (dataSize<0){
		    return(false);
		  }
		  if (inAddr>BitInput.MAX_SIZE/2) {
		    if (dataSize>0){
		      //memmove(InBuf,InBuf+InAddr,DataSize);
//		    	for (int i = 0; i < dataSize; i++) {
//					inBuf[i] = inBuf[inAddr + i];
//				}
                System.arraycopy(inBuf, inAddr, inBuf, 0, dataSize);
		    }
		    inAddr=0;
		    readTop=dataSize;
		  }
		  else{
		    dataSize=readTop;
		  }
		  //int readCode=UnpIO->UnpRead(InBuf+DataSize,(BitInput::MAX_SIZE-DataSize)&~0xf);
		  int readCode=unpIO.unpRead(inBuf, dataSize, (BitInput.MAX_SIZE-dataSize)&~0xf);
		  if (readCode>0){
		    readTop+=readCode;
		  }
		  readBorder=readTop-30;
		  return(readCode!=-1);
	}

	private int getShortLen1(int pos)
	{
		return pos == 1 ? Buf60 + 3 : ShortLen1[pos];
	}

	private int getShortLen2(int pos)
	{
		return pos == 3 ? Buf60 + 3 : ShortLen2[pos];
	}

	protected void shortLZ()
	{
		int Length, SaveLength;
		int LastDistance;
		int Distance;
		int DistancePlace;
		NumHuf = 0;

		int BitField = fgetbits();
		if (LCount == 2) {
			faddbits(1);
			if (BitField >= 0x8000) {
				oldCopyString(lastDist, lastLength);
				return;
			}
			BitField <<= 1;
			LCount = 0;
		}
		BitField >>>= 8;
		if (AvrLn1 < 37) {
			for (Length = 0;; Length++) {
				if (((BitField ^ ShortXor1[Length]) & (~(0xff >>> getShortLen1(Length)))) == 0) {
					break;
				}
			}
			faddbits(getShortLen1(Length));
		} else {
			for (Length = 0;; Length++) {
				if (((BitField ^ ShortXor2[Length]) & (~(0xff >> getShortLen2(Length)))) == 0) {
					break;
				}
			}
			faddbits(getShortLen2(Length));
		}

		if (Length >= 9) {
			if (Length == 9) {
				LCount++;
				oldCopyString(lastDist, lastLength);
				return;
			}
			if (Length == 14) {
				LCount = 0;
				Length = decodeNum(fgetbits(), STARTL2, DecL2, PosL2) + 5;
				Distance = (fgetbits() >> 1) | 0x8000;
				faddbits(15);
				lastLength = Length;
				lastDist = Distance;
				oldCopyString(Distance, Length);
				return;
			}

			LCount = 0;
			SaveLength = Length;
			Distance = oldDist[(oldDistPtr - (Length - 9)) & 3];
			Length = decodeNum(fgetbits(), STARTL1, DecL1, PosL1) + 2;
			if (Length == 0x101 && SaveLength == 10) {
				Buf60 ^= 1;
				return;
			}
			if (Distance > 256)
				Length++;
			if (Distance >= MaxDist3)
				Length++;

			oldDist[oldDistPtr++] = Distance;
			oldDistPtr = oldDistPtr & 3;
			lastLength = Length;
			lastDist = Distance;
			oldCopyString(Distance, Length);
			return;
		}

		LCount = 0;
		AvrLn1 += Length;
		AvrLn1 -= AvrLn1 >> 4;

		DistancePlace = decodeNum(fgetbits(), STARTHF2, DecHf2, PosHf2) & 0xff;
		Distance = ChSetA[DistancePlace];
		if (--DistancePlace != -1) {
			PlaceA[Distance]--;
			LastDistance = ChSetA[DistancePlace];
			PlaceA[LastDistance]++;
			ChSetA[DistancePlace + 1] = LastDistance;
			ChSetA[DistancePlace] = Distance;
		}
		Length += 2;
		oldDist[oldDistPtr++] = ++Distance;
		oldDistPtr = oldDistPtr & 3;
		lastLength = Length;
		lastDist = Distance;
		oldCopyString(Distance, Length);
	}

	protected void longLZ()
	{
		int Length;
		int Distance;
		int DistancePlace, NewDistancePlace;
		int OldAvr2, OldAvr3;

		NumHuf = 0;
		Nlzb += 16;
		if (Nlzb > 0xff) {
			Nlzb = 0x90;
			Nhfb >>>= 1;
		}
		OldAvr2 = AvrLn2;

		int BitField = fgetbits();
		if (AvrLn2 >= 122) {
			Length = decodeNum(BitField, STARTL2, DecL2, PosL2);
		} else {
			if (AvrLn2 >= 64) {
				Length = decodeNum(BitField, STARTL1, DecL1, PosL1);
			} else {
				if (BitField < 0x100) {
					Length = BitField;
					faddbits(16);
				} else {
					for (Length = 0; ((BitField << Length) & 0x8000) == 0; Length++) {
						;
					}
					faddbits(Length + 1);
				}
			}
		}
		AvrLn2 += Length;
		AvrLn2 -= AvrLn2 >>> 5;

		BitField = fgetbits();
		if (AvrPlcB > 0x28ff) {
			DistancePlace = decodeNum(BitField, STARTHF2, DecHf2, PosHf2);
		} else {
			if (AvrPlcB > 0x6ff) {
				DistancePlace = decodeNum(BitField, STARTHF1, DecHf1, PosHf1);
			} else {
				DistancePlace = decodeNum(BitField, STARTHF0, DecHf0, PosHf0);
			}
		}
		AvrPlcB += DistancePlace;
		AvrPlcB -= AvrPlcB >> 8;
		while (true) {
			Distance = ChSetB[DistancePlace & 0xff];
			NewDistancePlace = NToPlB[Distance++ & 0xff]++;
			if ((Distance & 0xff) == 0) {
				corrHuff(ChSetB, NToPlB);
			} else {
				break;
			}
		}

		ChSetB[DistancePlace] = ChSetB[NewDistancePlace];
		ChSetB[NewDistancePlace] = Distance;

		Distance = ((Distance & 0xff00) | (fgetbits() >>> 8)) >>> 1;
		faddbits(7);

		OldAvr3 = AvrLn3;
		if (Length != 1 && Length != 4) {
			if (Length == 0 && Distance <= MaxDist3) {
				AvrLn3++;
				AvrLn3 -= AvrLn3 >> 8;
			} else {
				if (AvrLn3 > 0) {
					AvrLn3--;
				}
			}
		}
		Length += 3;
		if (Distance >= MaxDist3) {
			Length++;
		}
		if (Distance <= 256) {
			Length += 8;
		}
		if (OldAvr3 > 0xb0 || AvrPlc >= 0x2a00 && OldAvr2 < 0x40) {
			MaxDist3 = 0x7f00;
		} else {
			MaxDist3 = 0x2001;
		}
		oldDist[oldDistPtr++] = Distance;
		oldDistPtr = oldDistPtr & 3;
		lastLength = Length;
		lastDist = Distance;
		oldCopyString(Distance, Length);
	}

	protected void huffDecode()
	{
		int CurByte, NewBytePlace;
		int Length;
		int Distance;
		int BytePlace;

		int BitField = fgetbits();

		if (AvrPlc > 0x75ff) {
			BytePlace = decodeNum(BitField, STARTHF4, DecHf4, PosHf4);
		} else {
			if (AvrPlc > 0x5dff) {
				BytePlace = decodeNum(BitField, STARTHF3, DecHf3, PosHf3);
			} else {
				if (AvrPlc > 0x35ff) {
					BytePlace = decodeNum(BitField, STARTHF2, DecHf2, PosHf2);
				} else {
					if (AvrPlc > 0x0dff) {
						BytePlace = decodeNum(BitField, STARTHF1, DecHf1,
								PosHf1);
					} else {
						BytePlace = decodeNum(BitField, STARTHF0, DecHf0,
								PosHf0);
					}
				}
			}
		}
		BytePlace &= 0xff;
		if (StMode != 0) {
			if (BytePlace == 0 && BitField > 0xfff) {
				BytePlace = 0x100;
			}
			if (--BytePlace == -1) {
				BitField = fgetbits();
				faddbits(1);
				if ((BitField & 0x8000) != 0) {
					NumHuf = StMode = 0;
					return;
				} else {
					Length = (BitField & 0x4000) != 0 ? 4 : 3;
					faddbits(1);
					Distance = decodeNum(fgetbits(), STARTHF2, DecHf2, PosHf2);
					Distance = (Distance << 5) | (fgetbits() >>> 11);
					faddbits(5);
					oldCopyString(Distance, Length);
					return;
				}
			}
		} else {
			if (NumHuf++ >= 16 && FlagsCnt == 0) {
				StMode = 1;
			}
		}
		AvrPlc += BytePlace;
		AvrPlc -= AvrPlc >>> 8;
		Nhfb += 16;
		if (Nhfb > 0xff) {
			Nhfb = 0x90;
			Nlzb >>>= 1;
		}

		window[unpPtr++] = (byte) (ChSet[BytePlace] >>> 8);
		--destUnpSize;

		while (true) {
			CurByte = ChSet[BytePlace];
			NewBytePlace = NToPl[CurByte++ & 0xff]++;
			if ((CurByte & 0xff) > 0xa1) {
				corrHuff(ChSet, NToPl);
			} else {
				break;
			}
		}

		ChSet[BytePlace] = ChSet[NewBytePlace];
		ChSet[NewBytePlace] = CurByte;
	}

	protected void getFlagsBuf()
	{
		int Flags, NewFlagsPlace;
		int FlagsPlace = decodeNum(fgetbits(), STARTHF2, DecHf2, PosHf2);

		while (true) {
			Flags = ChSetC[FlagsPlace];
			FlagBuf = Flags >>> 8;
			NewFlagsPlace = NToPlC[Flags++ & 0xff]++;
			if ((Flags & 0xff) != 0) {
				break;
			}
			corrHuff(ChSetC, NToPlC);
		}

		ChSetC[FlagsPlace] = ChSetC[NewFlagsPlace];
		ChSetC[NewFlagsPlace] = Flags;
	}

	protected void oldUnpInitData(boolean Solid)
	{
		if (!Solid ) {
			AvrPlcB = AvrLn1 = AvrLn2 = AvrLn3 = NumHuf = Buf60 = 0;
			AvrPlc = 0x3500;
			MaxDist3 = 0x2001;
			Nhfb = Nlzb = 0x80;
		}
		FlagsCnt = 0;
		FlagBuf = 0;
		StMode = 0;
		LCount = 0;
		readTop = 0;
	}

	protected void initHuff()
	{
		for (int I = 0; I < 256; I++) {
			Place[I] = PlaceA[I] = PlaceB[I] = I;
			PlaceC[I] = (~I + 1) & 0xff;
			ChSet[I] = ChSetB[I] = I << 8;
			ChSetA[I] = I;
			ChSetC[I] = ((~I + 1) & 0xff) << 8;
		}

		Arrays.fill(NToPl, 0);// memset(NToPl,0,sizeof(NToPl));
		Arrays.fill(NToPlB, 0); // memset(NToPlB,0,sizeof(NToPlB));
		Arrays.fill(NToPlC, 0); // memset(NToPlC,0,sizeof(NToPlC));
		corrHuff(ChSetB, NToPlB);
	}

	protected void corrHuff(int[] CharSet, int[] NumToPlace)
	{
		int I, J, pos = 0;
		for (I = 7; I >= 0; I--) {
			for (J = 0; J < 32; J++, pos++) {
				CharSet[pos] = ((CharSet[pos] & ~0xff) | I);// *CharSet=(*CharSet
				// & ~0xff) | I;
			}
		}
		Arrays.fill(NumToPlace, 0);// memset(NumToPlace,0,sizeof(NToPl));
		for (I = 6; I >= 0; I--) {
			NumToPlace[I] = (7 - I) * 32;
		}
	}

	protected void oldCopyString(int Distance, int Length)
	{
		destUnpSize -= Length;
		while ((Length--) != 0) {
			window[unpPtr] = window[(unpPtr - Distance) & Compress.MAXWINMASK];
			unpPtr = (unpPtr + 1) & Compress.MAXWINMASK;
		}
	}

	protected int decodeNum(int Num, int StartPos, int[] DecTab, int[] PosTab)
	{
		int I;
		for (Num &= 0xfff0, I = 0; DecTab[I] <= Num; I++) {
			StartPos++;
		}
		faddbits(StartPos);
		return (((Num - (I != 0 ? DecTab[I - 1] : 0)) >>> (16 - StartPos)) + PosTab[StartPos]);
	}

	protected void oldUnpWriteBuf() throws IOException
	{
		if (unpPtr != wrPtr) {
			unpSomeRead = true;
		}
		if (unpPtr < wrPtr) {
			unpIO.unpWrite(window, wrPtr, -wrPtr & Compress.MAXWINMASK);
			unpIO.unpWrite(window, 0, unpPtr);
			unpAllBuf = true;
		} else {
			unpIO.unpWrite(window, wrPtr, unpPtr - wrPtr);
		}
		wrPtr = unpPtr;
	}


}


================================================
FILE: unrar/src/main/java/com/github/junrar/unpack/Unpack20.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 21.06.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.unpack;

import java.io.IOException;
import java.util.Arrays;

import com.github.junrar.exception.RarException;
import com.github.junrar.unpack.decode.AudioVariables;
import com.github.junrar.unpack.decode.BitDecode;
import com.github.junrar.unpack.decode.Compress;
import com.github.junrar.unpack.decode.Decode;
import com.github.junrar.unpack.decode.DistDecode;
import com.github.junrar.unpack.decode.LitDecode;
import com.github.junrar.unpack.decode.LowDistDecode;
import com.github.junrar.unpack.decode.MultDecode;
import com.github.junrar.unpack.decode.RepDecode;



/**
 * DOCUMENT ME
 * 
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public abstract class Unpack20 extends Unpack15
{

	protected MultDecode[] MD = new MultDecode[4];

	protected byte[] UnpOldTable20 = new byte[Compress.MC20 * 4];

	protected int UnpAudioBlock, UnpChannels, UnpCurChannel, UnpChannelDelta;

	protected AudioVariables[] AudV = new AudioVariables[4];

	protected LitDecode LD = new LitDecode();

	protected DistDecode DD = new DistDecode();

	protected LowDistDecode LDD = new LowDistDecode();

	protected RepDecode RD = new RepDecode();

	protected BitDecode BD = new BitDecode();

	public static final int[] LDecode = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12,
			14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192,
			224 };

	public static final byte[] LBits = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2,
			2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5 };

	public static final int[] DDecode = { 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32,
			48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072,
			4096, 6144, 8192, 12288, 16384, 24576, 32768, 49152, 65536, 98304,
			131072, 196608, 262144, 327680, 393216, 458752, 524288, 589824,
			655360, 720896, 786432, 851968, 917504, 983040 };

	public static final int[] DBits = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5,
			5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14,
			15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 };

	public static final int[] SDDecode = { 0, 4, 8, 16, 32, 64, 128, 192 };

	public static final int[] SDBits = { 2, 2, 3, 4, 5, 6, 6, 6 };

	protected void unpack20(boolean solid) throws IOException, RarException
	{

		int Bits;

		if (suspended) {
			unpPtr = wrPtr;
		} else {
			unpInitData(solid);
			if (!unpReadBuf()) {
				return;
			}
			if (!solid) {
				if (!ReadTables20()) {
					return;
				}
			}
			--destUnpSize;
		}

		while (destUnpSize >= 0) {
			unpPtr &= Compress.MAXWINMASK;

			if (inAddr > readTop - 30)
				if (!unpReadBuf())
					break;
			if (((wrPtr - unpPtr) & Compress.MAXWINMASK) < 270
					&& wrPtr != unpPtr) {
				oldUnpWriteBuf();
				if (suspended)
					return;
			}
			if (UnpAudioBlock != 0) {
				int AudioNumber = decodeNumber(MD[UnpCurChannel]);

				if (AudioNumber == 256) {
					if (!ReadTables20())
						break;
					continue;
				}
				window[unpPtr++] = DecodeAudio(AudioNumber);
				if (++UnpCurChannel == UnpChannels)
					UnpCurChannel = 0;
				--destUnpSize;
				continue;
			}

			int Number = decodeNumber(LD);
			if (Number < 256) {
				window[unpPtr++] = (byte) Number;
				--destUnpSize;
				continue;
			}
			if (Number > 269) {
				int Length = LDecode[Number -= 270] + 3;
				if ((Bits = LBits[Number]) > 0) {
					Length += getbits() >>> (16 - Bits);
					addbits(Bits);
				}

				int DistNumber = decodeNumber(DD);
				int Distance = DDecode[DistNumber] + 1;
				if ((Bits = DBits[DistNumber]) > 0) {
					Distance += getbits() >>> (16 - Bits);
					addbits(Bits);
				}

				if (Distance >= 0x2000) {
					Length++;
					if (Distance >= 0x40000L)
						Length++;
				}

				CopyString20(Length, Distance);
				continue;
			}
			if (Number == 269) {
				if (!ReadTables20())
					break;
				continue;
			}
			if (Number == 256) {
				CopyString20(lastLength, lastDist);
				continue;
			}
			if (Number < 261) {
				int Distance = oldDist[(oldDistPtr - (Number - 256)) & 3];
				int LengthNumber = decodeNumber(RD);
				int Length = LDecode[LengthNumber] + 2;
				if ((Bits = LBits[LengthNumber]) > 0) {
					Length += getbits() >>> (16 - Bits);
					addbits(Bits);
				}
				if (Distance >= 0x101) {
					Length++;
					if (Distance >= 0x2000) {
						Length++;
						if (Distance >= 0x40000)
							Length++;
					}
				}
				CopyString20(Length, Distance);
				continue;
			}
			if (Number < 270) {
				int Distance = SDDecode[Number -= 261] + 1;
				if ((Bits = SDBits[Number]) > 0) {
					Distance += getbits() >>> (16 - Bits);
					addbits(Bits);
				}
				CopyString20(2, Distance);
				continue;
			}
		}
		ReadLastTables();
		oldUnpWriteBuf();

	}

	protected void CopyString20(int Length, int Distance)
	{
		lastDist = oldDist[oldDistPtr++ & 3] = Distance;
		lastLength = Length;
		destUnpSize -= Length;

		int DestPtr = unpPtr - Distance;
		if (DestPtr < Compress.MAXWINSIZE - 300
				&& unpPtr < Compress.MAXWINSIZE - 300) {
			window[unpPtr++] = window[DestPtr++];
			window[unpPtr++] = window[DestPtr++];
			while (Length > 2) {
				Length--;
				window[unpPtr++] = window[DestPtr++];
			}
		} else {
			while ((Length--) != 0) {
				window[unpPtr] = window[DestPtr++ & Compress.MAXWINMASK];
				unpPtr = (unpPtr + 1) & Compress.MAXWINMASK;
			}
		}
	}

	protected void makeDecodeTables(byte[] lenTab, int offset, Decode dec,
			int size)
	{
		int[] lenCount = new int[16];
		int[] tmpPos = new int[16];
		int i;
		long M, N;

		Arrays.fill(lenCount, 0);// memset(LenCount,0,sizeof(LenCount));

		Arrays.fill(dec.getDecodeNum(), 0);// memset(Dec->DecodeNum,0,Size*sizeof(*Dec->DecodeNum));

		for (i = 0; i < size; i++) {
			lenCount[(int) (lenTab[offset + i] & 0xF)]++;
		}
		lenCount[0] = 0;
		for (tmpPos[0] = 0, dec.getDecodePos()[0] = 0, dec.getDecodeLen()[0] = 0, N = 0, i = 1; i < 16; i++) {
			N = 2 * (N + lenCount[i]);
			M = N << (15 - i);
			if (M > 0xFFFF) {
				M = 0xFFFF;
			}
			dec.getDecodeLen()[i] = (int) M;
			tmpPos[i] = dec.getDecodePos()[i] = dec.getDecodePos()[i - 1]
					+ lenCount[i - 1];
		}

		for (i = 0; i < size; i++) {
			if (lenTab[offset + i] != 0) {
				dec.getDecodeNum()[tmpPos[lenTab[offset + i] & 0xF]++] = i;
			}
		}
		dec.setMaxNum(size);
	}

	protected int decodeNumber(Decode dec)
	{
		int bits;
		long bitField = getbits() & 0xfffe;
//        if (bitField < dec.getDecodeLen()[8]) {
//			if (bitField < dec.getDecodeLen()[4]) {
//				if (bitField < dec.getDecodeLen()[2]) {
//					if (bitField < dec.getDecodeLen()[1]) {
//						bits = 1;
//					} else {
//						bits = 2;
//					}
//				} else {
//					if (bitField < dec.getDecodeLen()[3]) {
//						bits = 3;
//					} else {
//						bits = 4;
//					}
//				}
//			} else {
//				if (bitField < dec.getDecodeLen()[6]) {
//					if (bitField < dec.getDecodeLen()[5])
//						bits = 5;
//					else
//						bits = 6;
//				} else {
//					if (bitField < dec.getDecodeLen()[7]) {
//						bits = 7;
//					} else {
//						bits = 8;
//					}
//				}
//			}
//		} else {
//			if (bitField < dec.getDecodeLen()[12]) {
//				if (bitField < dec.getDecodeLen()[10])
//					if (bitField < dec.getDecodeLen()[9])
//						bits = 9;
//					else
//						bits = 10;
//				else if (bitField < dec.getDecodeLen()[11])
//					bits = 11;
//				else
//					bits = 12;
//			} else {
//				if (bitField < dec.getDecodeLen()[14]) {
//					if (bitField < dec.getDecodeLen()[13]) {
//						bits = 13;
//					} else {
//						bits = 14;
//					}
//				} else {
//					bits = 15;
//				}
//			}
//		}
//		addbits(bits);
//		int N = dec.getDecodePos()[bits]
//				+ (((int) bitField - dec.getDecodeLen()[bits - 1]) >>> (16 - bits));
//		if (N >= dec.getMaxNum()) {
//			N = 0;
//		}
//		return (dec.getDecodeNum()[N]);
        int[] decodeLen = dec.getDecodeLen();
        if (bitField < decodeLen[8]) {
			if (bitField < decodeLen[4]) {
				if (bitField < decodeLen[2]) {
					if (bitField < decodeLen[1]) {
						bits = 1;
					} else {
						bits = 2;
					}
				} else {
					if (bitField < decodeLen[3]) {
						bits = 3;
					} else {
						bits = 4;
					}
				}
			} else {
				if (bitField < decodeLen[6]) {
					if (bitField < decodeLen[5])
						bits = 5;
					else
						bits = 6;
				} else {
					if (bitField < decodeLen[7]) {
						bits = 7;
					} else {
						bits = 8;
					}
				}
			}
		} else {
			if (bitField < decodeLen[12]) {
				if (bitField < decodeLen[10])
					if (bitField < decodeLen[9])
						bits = 9;
					else
						bits = 10;
				else if (bitField < decodeLen[11])
					bits = 11;
				else
					bits = 12;
			} else {
				if (bitField < decodeLen[14]) {
					if (bitField < decodeLen[13]) {
						bits = 13;
					} else {
						bits = 14;
					}
				} else {
					bits = 15;
				}
			}
		}
		addbits(bits);
		int N = dec.getDecodePos()[bits]
				+ (((int) bitField - decodeLen[bits - 1]) >>> (16 - bits));
		if (N >= dec.getMaxNum()) {
			N = 0;
		}
		return (dec.getDecodeNum()[N]);
	}

	protected boolean ReadTables20() throws IOException, RarException
	{
		byte[] BitLength = new byte[Compress.BC20];
		byte[] Table = new byte[Compress.MC20 * 4];
		int TableSize, N, I;
		if (inAddr > readTop - 25) {
			if (!unpReadBuf()) {
				return (false);
			}
		}
		int BitField = getbits();
		UnpAudioBlock = (BitField & 0x8000);

		if (0 == (BitField & 0x4000)) {
			// memset(UnpOldTable20,0,sizeof(UnpOldTable20));
			Arrays.fill(UnpOldTable20, (byte) 0);
		}
		addbits(2);

		if (UnpAudioBlock != 0) {
			UnpChannels = ((BitField >>> 12) & 3) + 1;
			if (UnpCurChannel >= UnpChannels) {
				UnpCurChannel = 0;
			}
			addbits(2);
			TableSize = Compress.MC20 * UnpChannels;
		} else {
			TableSize = Compress.NC20 + Compress.DC20 + Compress.RC20;
		}
		for (I = 0; I < Compress.BC20; I++) {
			BitLength[I] = (byte) (getbits() >>> 12);
			addbits(4);
		}
		makeDecodeTables(BitLength, 0, BD, Compress.BC20);
		I = 0;
		while (I < TableSize) {
			if (inAddr > readTop - 5) {
				if (!unpReadBuf()) {
					return (false);
				}
			}
			int Number = decodeNumber(BD);
			if (Number < 16) {
				Table[I] = (byte) ((Number + UnpOldTable20[I]) & 0xf);
				I++;
			} else if (Number == 16) {
				N = (getbits() >>> 14) + 3;
				addbits(2);
				while (N-- > 0 && I < TableSize) {
					Table[I] = Table[I - 1];
					I++;
				}
			} else {
				if (Number == 17) {
					N = (getbits() >>> 13) + 3;
					addbits(3);
				} else {
					N = (getbits() >>> 9) + 11;
					addbits(7);
				}
				while (N-- > 0 && I < TableSize)
					Table[I++] = 0;
			}
		}
		if (inAddr > readTop) {
			return (true);
		}
		if (UnpAudioBlock != 0)
			for (I = 0; I < UnpChannels; I++)
				makeDecodeTables(Table, I * Compress.MC20, MD[I], Compress.MC20);
		else {
			makeDecodeTables(Table, 0, LD, Compress.NC20);
			makeDecodeTables(Table, Compress.NC20, DD, Compress.DC20);
			makeDecodeTables(Table, Compress.NC20 + Compress.DC20, RD,
					Compress.RC20);
		}
		// memcpy(UnpOldTable20,Table,sizeof(UnpOldTable20));
		for (int i = 0; i < UnpOldTable20.length; i++) {
			UnpOldTable20[i] = Table[i];
		}
		return (true);
	}

	protected void unpInitData20(boolean Solid)
	{
		if (!Solid) {
			UnpChannelDelta = UnpCurChannel = 0;
			UnpChannels = 1;
			// memset(AudV,0,sizeof(AudV));
			Arrays.fill(AudV, new AudioVariables());
			// memset(UnpOldTable20,0,sizeof(UnpOldTable20));
			Arrays.fill(UnpOldTable20, (byte) 0);
		}
	}

	protected void ReadLastTables() throws IOException, RarException
	{
		if (readTop >= inAddr + 5) {
			if (UnpAudioBlock != 0) {
				if (decodeNumber(MD[UnpCurChannel]) == 256) {
					ReadTables20();
				}
			} else {
				if (decodeNumber(LD) == 269) {
					ReadTables20();
				}
			}
		}
	}

	protected byte DecodeAudio(int Delta)
	{
		AudioVariables v = AudV[UnpCurChannel];
		v.setByteCount(v.getByteCount() + 1);
		v.setD4(v.getD3());
		v.setD3(v.getD2());// ->D3=V->D2;
		v.setD2(v.getLastDelta() - v.getD1());// ->D2=V->LastDelta-V->D1;
		v.setD1(v.getLastDelta());// V->D1=V->LastDelta;
		// int PCh=8*V->LastChar+V->K1*V->D1 +V->K2*V->D2 +V->K3*V->D3
		// +V->K4*V->D4+ V->K5*UnpChannelDelta;
		int PCh = 8 * v.getLastChar() + v.getK1() * v.getD1();
		PCh += v.getK2() * v.getD2() + v.getK3() * v.getD3();
		PCh += v.getK4() * v.getD4() + v.getK5() * UnpChannelDelta;
		PCh = (PCh >>> 3) & 0xFF;

		int Ch = PCh - Delta;

		int D = ((byte) Delta) << 3;

		v.getDif()[0] += Math.abs(D);// V->Dif[0]+=abs(D);
		v.getDif()[1] += Math.abs(D - v.getD1());// V->Dif[1]+=abs(D-V->D1);
		v.getDif()[2] += Math.abs(D + v.getD1());// V->Dif[2]+=abs(D+V->D1);
		v.getDif()[3] += Math.abs(D - v.getD2());// V->Dif[3]+=abs(D-V->D2);
		v.getDif()[4] += Math.abs(D + v.getD2());// V->Dif[4]+=abs(D+V->D2);
		v.getDif()[5] += Math.abs(D - v.getD3());// V->Dif[5]+=abs(D-V->D3);
		v.getDif()[6] += Math.abs(D + v.getD3());// V->Dif[6]+=abs(D+V->D3);
		v.getDif()[7] += Math.abs(D - v.getD4());// V->Dif[7]+=abs(D-V->D4);
		v.getDif()[8] += Math.abs(D + v.getD4());// V->Dif[8]+=abs(D+V->D4);
		v.getDif()[9] += Math.abs(D - UnpChannelDelta);// V->Dif[9]+=abs(D-UnpChannelDelta);
		v.getDif()[10] += Math.abs(D + UnpChannelDelta);// V->Dif[10]+=abs(D+UnpChannelDelta);

		v.setLastDelta((byte) (Ch - v.getLastChar()));
		UnpChannelDelta = v.getLastDelta();
		v.setLastChar(Ch);// V->LastChar=Ch;

		if ((v.getByteCount() & 0x1F) == 0) {
			int MinDif = v.getDif()[0], NumMinDif = 0;
			v.getDif()[0] = 0;// ->Dif[0]=0;
			for (int I = 1; I < v.getDif().length; I++) {
				if (v.getDif()[I] < MinDif) {
					MinDif = v.getDif()[I];
					NumMinDif = I;
				}
				v.getDif()[I] = 0;
			}
			switch (NumMinDif) {
			case 1:
				if (v.getK1() >= -16) {
					v.setK1(v.getK1() - 1);// V->K1--;
				}
				break;
			case 2:
				if (v.getK1() < 16) {
					v.setK1(v.getK1() + 1);// V->K1++;
				}
				break;
			case 3:
				if (v.getK2() >= -16) {
					v.setK2(v.getK2() - 1);// V->K2--;
				}
				break;
			case 4:
				if (v.getK2() < 16) {
					v.setK2(v.getK2() + 1);// V->K2++;
				}
				break;
			case 5:
				if (v.getK3() >= -16) {
					v.setK3(v.getK3() - 1);
				}
				break;
			case 6:
				if (v.getK3() < 16) {
					v.setK3(v.getK3() + 1);
				}
				break;
			case 7:
				if (v.getK4() >= -16) {
					v.setK4(v.getK4() - 1);
				}
				break;
			case 8:
				if (v.getK4() < 16) {
					v.setK4(v.getK4() + 1);
				}
				break;
			case 9:
				if (v.getK5() >= -16) {
					v.setK5(v.getK5() - 1);
				}
				break;
			case 10:
				if (v.getK5() < 16) {
					v.setK5(v.getK5() + 1);
				}
				break;
			}
		}
		return ((byte) Ch);
	}

}


================================================
FILE: unrar/src/main/java/com/github/junrar/unpack/UnpackFilter.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 01.06.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.unpack;

import com.github.junrar.unpack.vm.VMPreparedProgram;

/**
 * DOCUMENT ME
 * 
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class UnpackFilter {

	private int BlockStart;

	private int BlockLength;

	private int ExecCount;

	private boolean NextWindow;

	// position of parent filter in Filters array used as prototype for filter
	// in PrgStack array. Not defined for filters in Filters array.
	private int ParentFilter;

	private VMPreparedProgram Prg  = new VMPreparedProgram();

	public int getBlockLength() {
		return BlockLength;
	}

	public void setBlockLength(int blockLength) {
		BlockLength = blockLength;
	}

	public int getBlockStart() {
		return BlockStart;
	}

	public void setBlockStart(int blockStart) {
		BlockStart = blockStart;
	}

	public int getExecCount() {
		return ExecCount;
	}

	public void setExecCount(int execCount) {
		ExecCount = execCount;
	}

	public boolean isNextWindow() {
		return NextWindow;
	}

	public void setNextWindow(boolean nextWindow) {
		NextWindow = nextWindow;
	}

	public int getParentFilter() {
		return ParentFilter;
	}

	public void setParentFilter(int parentFilter) {
		ParentFilter = parentFilter;
	}

	public VMPreparedProgram getPrg() {
		return Prg;
	}

	public void setPrg(VMPreparedProgram prg) {
		Prg = prg;
	}

	
	
}


================================================
FILE: unrar/src/main/java/com/github/junrar/unpack/decode/AudioVariables.java
================================================
/*
 * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
 * Original author: Edmund Wagner
 * Creation date: 01.06.2007
 *
 * Source: $HeadURL$
 * Last changed: $LastChangedDate$
 * 
 * the unrar licence applies to all junrar source and binary distributions 
 * you are not allowed to use this source to re-create the RAR compression algorithm
 * 
 * Here some html entities which can be used for escaping javadoc tags:
 * "&":  "&#038;" or "&amp;"
 * "<":  "&#060;" or "&lt;"
 * ">":  "&#062;" or "&gt;"
 * "@":  "&#064;" 
 */
package com.github.junrar.unpack.decode;

/**
 * DOCUMENT ME
 * 
 * @author $LastChangedBy$
 * @version $LastChangedRevision$
 */
public class AudioVariables {
	int k1, k2, k3, k4, k5;

	int d1, d2, d3, d4;

	int lastDelta;

	int dif[] = new int[11];

	int byteCount;

	int lastChar;

	public int getByteCount() {
		return byteCount;
	}

	public void setByteCount(int byteCount) {
		this.byteCount = byteCount;
	}

	public int getD1() {
		return d1;
	}

	public void setD1(int d1) {
		this.d1 = d1;
	}

	public int getD2() {
		return d2;
	}

	public void setD2(int d2) {
		this.d2 = d2;
	}

	public int getD3() {
		return d3;
	}

	public void setD3(int d3) {
		this.d3 = d3;
	}

	public int getD4() {
		return d4;
	}

	public void setD4(int d4) {
		this.d4 = d4;
	}

	public int[] getDif() {
		return dif;
	}

	public void setDif(int[] dif) {
		this.dif = dif;
	}

	public int getK1() {
		return k1;
	}

	public void setK1(int k1) {
		this.k1 = k1;
	}

	public int getK2() {
		return k2;
	}

	public void setK2(int k2) {
		this.k2 = k2;
	}

	public int getK3() {
		return k3;
	}

	public void setK3(int k3) {
		this.k3 = k3;
	}

	public int getK4() {
		return k4;
	}

	public void setK4(int k4) {
		this.k4 = k4;
	}

	public int getK5() {
		return k5;
	}

	public void setK5(int k5) {
		this.k5 = k5;
	}

	public int getLastChar() {
		return lastChar;
	}

	public void setLastChar(int lastChar) {
		this.lastChar = lastChar;
	}

	public int getLastDelta() {
		return lastDelta;
	}

	public void setLastDelta(int lastDelta) {
		this.lastDelta = lastDelta;
	}

	
}


=================================
Download .txt
gitextract_8hmv49fy/

├── .gitignore
├── license.txt
├── testutil/
│   ├── .gitignore
│   ├── pom.xml
│   └── src/
│       └── main/
│           ├── java/
│           │   └── com/
│           │       └── github/
│           │           └── junrar/
│           │               └── testutil/
│           │                   ├── ExtractArchive.java
│           │                   └── JUnRarTestUtil.java
│           └── resources/
│               └── META-INF/
│                   └── MANIFEST.MF
└── unrar/
    ├── .gitignore
    ├── generate-testdata.sh
    ├── pom.xml
    ├── readme.md
    └── src/
        └── main/
            └── java/
                └── com/
                    └── github/
                        └── junrar/
                            ├── Archive.java
                            ├── MVTest.java
                            ├── UnrarCallback.java
                            ├── Volume.java
                            ├── VolumeManager.java
                            ├── crc/
                            │   └── RarCRC.java
                            ├── crypt/
                            │   └── Rijndael.java
                            ├── exception/
                            │   └── RarException.java
                            ├── impl/
                            │   ├── FileVolume.java
                            │   └── FileVolumeManager.java
                            ├── io/
                            │   ├── IReadOnlyAccess.java
                            │   ├── InputStreamReadOnlyAccessFile.java
                            │   ├── RandomAccessStream.java
                            │   ├── Raw.java
                            │   ├── ReadOnlyAccessByteArray.java
                            │   ├── ReadOnlyAccessFile.java
                            │   └── ReadOnlyAccessInputStream.java
                            ├── rarfile/
                            │   ├── AVHeader.java
                            │   ├── BaseBlock.java
                            │   ├── BlockHeader.java
                            │   ├── CommentHeader.java
                            │   ├── EAHeader.java
                            │   ├── EndArcHeader.java
                            │   ├── FileHeader.java
                            │   ├── FileNameDecoder.java
                            │   ├── HostSystem.java
                            │   ├── MacInfoHeader.java
                            │   ├── MainHeader.java
                            │   ├── MarkHeader.java
                            │   ├── NewSubHeaderType.java
                            │   ├── ProtectHeader.java
                            │   ├── SignHeader.java
                            │   ├── SubBlockHeader.java
                            │   ├── SubBlockHeaderType.java
                            │   ├── UnixOwnersHeader.java
                            │   └── UnrarHeadertype.java
                            ├── unpack/
                            │   ├── ComprDataIO.java
                            │   ├── Unpack.java
                            │   ├── Unpack15.java
                            │   ├── Unpack20.java
                            │   ├── UnpackFilter.java
                            │   ├── decode/
                            │   │   ├── AudioVariables.java
                            │   │   ├── BitDecode.java
                            │   │   ├── CodeType.java
                            │   │   ├── Compress.java
                            │   │   ├── Decode.java
                            │   │   ├── DistDecode.java
                            │   │   ├── FilterType.java
                            │   │   ├── LitDecode.java
                            │   │   ├── LowDistDecode.java
                            │   │   ├── MultDecode.java
                            │   │   └── RepDecode.java
                            │   ├── ppm/
                            │   │   ├── AnalyzeHeapDump.java
                            │   │   ├── BlockTypes.java
                            │   │   ├── FreqData.java
                            │   │   ├── ModelPPM.java
                            │   │   ├── PPMContext.java
                            │   │   ├── Pointer.java
                            │   │   ├── RangeCoder.java
                            │   │   ├── RarMemBlock.java
                            │   │   ├── RarNode.java
                            │   │   ├── SEE2Context.java
                            │   │   ├── State.java
                            │   │   ├── StateRef.java
                            │   │   └── SubAllocator.java
                            │   └── vm/
                            │       ├── BitInput.java
                            │       ├── RarVM.java
                            │       ├── VMCmdFlags.java
                            │       ├── VMCommands.java
                            │       ├── VMFlags.java
                            │       ├── VMOpType.java
                            │       ├── VMPreparedCommand.java
                            │       ├── VMPreparedOperand.java
                            │       ├── VMPreparedProgram.java
                            │       ├── VMStandardFilterSignature.java
                            │       └── VMStandardFilters.java
                            ├── unsigned/
                            │   ├── UnsignedByte.java
                            │   ├── UnsignedInteger.java
                            │   ├── UnsignedLong.java
                            │   └── UnsignedShort.java
                            ├── util/
                            │   └── VolumeHelper.java
                            └── vfs2/
                                └── provider/
                                    └── rar/
                                        ├── RARFileObject.java
                                        ├── RARFileProvider.java
                                        ├── RARFileSystem.java
                                        ├── RandomAccessContentAccess.java
                                        ├── VFSVolume.java
                                        └── VFSVolumeManager.java
Download .txt
SYMBOL INDEX (803 symbols across 89 files)

FILE: testutil/src/main/java/com/github/junrar/testutil/ExtractArchive.java
  class ExtractArchive (line 21) | public class ExtractArchive {
    method extractArchive (line 26) | public static void extractArchive(String archive, String destination) {
    method main (line 43) | public static void main(String[] args) {
    method extractArchive (line 52) | public static void extractArchive(File archive, File destination) {
    method createFile (line 96) | private static File createFile(FileHeader fh, File destination) {
    method makeFile (line 115) | private static File makeFile(File destination, String name)
    method createDirectory (line 139) | private static void createDirectory(FileHeader fh, File destination) {
    method makeDirectory (line 154) | private static void makeDirectory(File destination, String fileName) {

FILE: testutil/src/main/java/com/github/junrar/testutil/JUnRarTestUtil.java
  class JUnRarTestUtil (line 43) | public class JUnRarTestUtil
    method main (line 55) | public static void main(String[] args)
    method printSummary (line 74) | private static void printSummary()
    method testFile (line 98) | private static void testFile(File file)
    method recurseDirectory (line 179) | private static void recurseDirectory(File file)

FILE: unrar/src/main/java/com/github/junrar/Archive.java
  class Archive (line 62) | public class Archive implements Closeable {
    method Archive (line 90) | public Archive(VolumeManager volumeManager) throws RarException,
    method Archive (line 103) | public Archive(VolumeManager volumeManager, UnrarCallback unrarCallback)
    method Archive (line 112) | public Archive(File firstVolume) throws RarException, IOException {
    method Archive (line 116) | public Archive(File firstVolume, UnrarCallback unrarCallback)
    method setFile (line 130) | private void setFile(IReadOnlyAccess file, long length) throws IOExcep...
    method bytesReadRead (line 156) | public void bytesReadRead(int count) {
    method getRof (line 166) | public IReadOnlyAccess getRof() {
    method getFileHeaders (line 173) | public List<FileHeader> getFileHeaders() {
    method nextFileHeader (line 183) | public FileHeader nextFileHeader() {
    method getUnrarCallback (line 194) | public UnrarCallback getUnrarCallback() {
    method isEncrypted (line 202) | public boolean isEncrypted() {
    method readHeaders (line 217) | private void readHeaders(long fileLength) throws IOException, RarExcep...
    method extractFile (line 438) | public void extractFile(FileHeader hd, OutputStream os) throws RarExce...
    method getInputStream (line 464) | public InputStream getInputStream(final FileHeader hd) throws RarExcep...
    method doExtractFile (line 488) | private void doExtractFile(FileHeader hd, OutputStream os)
    method getMainHeader (line 530) | public MainHeader getMainHeader() {
    method isOldFormat (line 537) | public boolean isOldFormat() {
    method close (line 542) | public void close() throws IOException {
    method getVolumeManager (line 555) | public VolumeManager getVolumeManager() {
    method setVolumeManager (line 563) | public void setVolumeManager(VolumeManager volumeManager) {
    method getVolume (line 570) | public Volume getVolume() {
    method setVolume (line 579) | public void setVolume(Volume volume) throws IOException {

FILE: unrar/src/main/java/com/github/junrar/MVTest.java
  class MVTest (line 13) | public class MVTest {
    method main (line 18) | public static void main(String[] args) {

FILE: unrar/src/main/java/com/github/junrar/UnrarCallback.java
  type UnrarCallback (line 8) | public interface UnrarCallback {
    method isNextVolumeReady (line 14) | boolean isNextVolumeReady(Volume nextVolume);
    method volumeProgressChanged (line 20) | void volumeProgressChanged(long current, long total);

FILE: unrar/src/main/java/com/github/junrar/Volume.java
  type Volume (line 28) | public interface Volume {
    method getReadOnlyAccess (line 33) | IReadOnlyAccess getReadOnlyAccess() throws IOException;
    method getLength (line 38) | long getLength();
    method getArchive (line 43) | Archive getArchive();

FILE: unrar/src/main/java/com/github/junrar/VolumeManager.java
  type VolumeManager (line 25) | public interface VolumeManager {
    method nextArchive (line 26) | public Volume nextArchive(Archive archive, Volume lastVolume)

FILE: unrar/src/main/java/com/github/junrar/crc/RarCRC.java
  class RarCRC (line 27) | public class RarCRC {
    method RarCRC (line 47) | private RarCRC() {
    method checkCrc (line 50) | public static int checkCrc(int startCrc, byte[] data, int offset,
    method checkOldCrc (line 121) | public static short checkOldCrc(short startCrc, byte[] data, int count) {

FILE: unrar/src/main/java/com/github/junrar/crypt/Rijndael.java
  class Rijndael (line 25) | public class Rijndael {

FILE: unrar/src/main/java/com/github/junrar/exception/RarException.java
  class RarException (line 26) | public class RarException extends Exception
    method RarException (line 31) | public RarException(Exception e){
    method RarException (line 36) | public RarException(RarException e)
    method RarException (line 43) | public RarException(RarExceptionType type){
    type RarExceptionType (line 50) | public enum RarExceptionType{
    method getType (line 64) | public RarExceptionType getType()
    method setType (line 69) | public void setType(RarExceptionType type)

FILE: unrar/src/main/java/com/github/junrar/impl/FileVolume.java
  class FileVolume (line 32) | public class FileVolume implements Volume {
    method FileVolume (line 39) | public FileVolume(Archive archive, File file) {
    method getReadOnlyAccess (line 44) | @Override
    method getLength (line 49) | @Override
    method getArchive (line 54) | @Override
    method getFile (line 62) | public File getFile() {

FILE: unrar/src/main/java/com/github/junrar/impl/FileVolumeManager.java
  class FileVolumeManager (line 32) | public class FileVolumeManager implements VolumeManager {
    method FileVolumeManager (line 35) | public FileVolumeManager(File firstVolume) {
    method nextArchive (line 39) | @Override

FILE: unrar/src/main/java/com/github/junrar/io/IReadOnlyAccess.java
  type IReadOnlyAccess (line 29) | public interface IReadOnlyAccess {
    method getPosition (line 34) | public long getPosition() throws IOException;
    method setPosition (line 40) | public void setPosition(long pos) throws IOException;
    method read (line 43) | public int read() throws IOException;
    method read (line 48) | public int read(byte[] buffer, int off, int count) throws IOException;
    method readFully (line 57) | public int readFully(byte[] buffer, int count) throws IOException;
    method close (line 60) | public void close() throws IOException;

FILE: unrar/src/main/java/com/github/junrar/io/InputStreamReadOnlyAccessFile.java
  class InputStreamReadOnlyAccessFile (line 16) | public class InputStreamReadOnlyAccessFile implements IReadOnlyAccess {
    method InputStreamReadOnlyAccessFile (line 24) | public InputStreamReadOnlyAccessFile(final InputStream is) {
    method getPosition (line 28) | @Override
    method setPosition (line 33) | @Override
    method read (line 38) | @Override
    method read (line 43) | @Override
    method readFully (line 48) | @Override
    method close (line 54) | @Override

FILE: unrar/src/main/java/com/github/junrar/io/RandomAccessStream.java
  class RandomAccessStream (line 15) | @SuppressWarnings("rawtypes")
    method RandomAccessStream (line 33) | public RandomAccessStream(InputStream inputstream) {
    method RandomAccessStream (line 42) | public RandomAccessStream(RandomAccessFile ras) {
    method getFilePointer (line 46) | public int getFilePointer() throws IOException {
    method getLongFilePointer (line 53) | public long getLongFilePointer() throws IOException {
    method read (line 60) | public int read() throws IOException {
    method read (line 73) | public int read(byte[] bytes, int off, int len) throws IOException {
    method readFully (line 96) | public final void readFully(byte[] bytes) throws IOException {
    method readFully (line 100) | public final void readFully(byte[] bytes, int len) throws IOException {
    method readUntil (line 110) | @SuppressWarnings("unchecked")
    method seek (line 139) | public void seek(long loc) throws IOException {
    method seek (line 150) | public void seek(int loc) throws IOException {
    method readInt (line 162) | public final int readInt() throws IOException {
    method readLong (line 173) | public final long readLong() throws IOException {
    method readDouble (line 177) | public final double readDouble() throws IOException {
    method readShort (line 181) | public final short readShort() throws IOException {
    method readFloat (line 190) | public final float readFloat() throws IOException {
    method close (line 194) | public void close() throws IOException {

FILE: unrar/src/main/java/com/github/junrar/io/Raw.java
  class Raw (line 26) | public class Raw {
    method readShortBigEndian (line 36) | public static final short readShortBigEndian(byte[] array, int pos) {
    method readIntBigEndian (line 53) | public static final int readIntBigEndian(byte[] array, int pos) {
    method readLongBigEndian (line 74) | public static final long readLongBigEndian(byte[] array, int pos) {
    method readShortLittleEndian (line 104) | public static final short readShortLittleEndian(byte[] array, int pos) {
    method readIntLittleEndian (line 122) | public static final int readIntLittleEndian(byte[] array, int pos) {
    method readIntLittleEndianAsLong (line 136) | public static final long readIntLittleEndianAsLong(byte[] array, int p...
    method readLongLittleEndian (line 153) | public static final long readLongLittleEndian(byte[] array, int pos) {
    method writeShortBigEndian (line 184) | public static final void writeShortBigEndian(byte[] array, int pos,
    method writeIntBigEndian (line 201) | public static final void writeIntBigEndian(byte[] array, int pos, int ...
    method writeLongBigEndian (line 219) | public static final void writeLongBigEndian(byte[] array, int pos,
    method writeShortLittleEndian (line 243) | public static final void writeShortLittleEndian(byte[] array, int pos,
    method incShortLittleEndian (line 254) | public static final void incShortLittleEndian(byte[] array, int pos, i...
    method writeIntLittleEndian (line 273) | public static final void writeIntLittleEndian(byte[] array, int pos,
    method writeLongLittleEndian (line 293) | public static final void writeLongLittleEndian(byte[] array, int pos,

FILE: unrar/src/main/java/com/github/junrar/io/ReadOnlyAccessByteArray.java
  class ReadOnlyAccessByteArray (line 30) | public class ReadOnlyAccessByteArray implements IReadOnlyAccess{
    method ReadOnlyAccessByteArray (line 39) | public ReadOnlyAccessByteArray(byte[] file){
    method getPosition (line 47) | public long getPosition() throws IOException {
    method setPosition (line 51) | public void setPosition(long pos) throws IOException {
    method read (line 61) | public int read() throws IOException {
    method read (line 68) | public int read(byte[] buffer, int off, int count) throws IOException {
    method readFully (line 75) | public int readFully(byte[] buffer, int count) throws IOException {
    method close (line 88) | public void close() throws IOException {

FILE: unrar/src/main/java/com/github/junrar/io/ReadOnlyAccessFile.java
  class ReadOnlyAccessFile (line 31) | public class ReadOnlyAccessFile extends RandomAccessFile
    method ReadOnlyAccessFile (line 38) | public ReadOnlyAccessFile(File file) throws FileNotFoundException {
    method readFully (line 42) | public int readFully(byte[] buffer, int count) throws IOException {
    method getPosition (line 48) | public long getPosition() throws IOException {
    method setPosition (line 52) | public void setPosition(long pos) throws IOException {

FILE: unrar/src/main/java/com/github/junrar/io/ReadOnlyAccessInputStream.java
  class ReadOnlyAccessInputStream (line 30) | public class ReadOnlyAccessInputStream extends InputStream {
    method ReadOnlyAccessInputStream (line 37) | public ReadOnlyAccessInputStream(IReadOnlyAccess file, long startPos,
    method read (line 47) | @Override
    method read (line 59) | @Override
    method read (line 73) | @Override

FILE: unrar/src/main/java/com/github/junrar/rarfile/AVHeader.java
  class AVHeader (line 29) | public class AVHeader extends BaseBlock {
    method AVHeader (line 38) | public AVHeader(BaseBlock bb, byte[] avHeader){
    method getAvInfoCRC (line 51) | public int getAvInfoCRC() {
    method getAvVersion (line 55) | public byte getAvVersion() {
    method getMethod (line 59) | public byte getMethod() {
    method getUnpackVersion (line 63) | public byte getUnpackVersion() {

FILE: unrar/src/main/java/com/github/junrar/rarfile/BaseBlock.java
  class BaseBlock (line 34) | public class BaseBlock{
    method BaseBlock (line 97) | public BaseBlock(){
    method BaseBlock (line 101) | public BaseBlock(BaseBlock bb){
    method BaseBlock (line 108) | public BaseBlock(byte[] baseBlockHeader){
    method hasArchiveDataCRC (line 121) | public boolean hasArchiveDataCRC(){
    method hasVolumeNumber (line 125) | public boolean hasVolumeNumber(){
    method hasEncryptVersion (line 129) | public boolean hasEncryptVersion(){
    method isSubBlock (line 136) | public boolean isSubBlock()
    method getPositionInFile (line 149) | public long getPositionInFile() {
    method getFlags (line 153) | public short getFlags() {
    method getHeadCRC (line 157) | public short getHeadCRC() {
    method getHeaderSize (line 161) | public short getHeaderSize() {
    method getHeaderType (line 165) | public UnrarHeadertype getHeaderType() {
    method setPositionInFile (line 169) | public void setPositionInFile(long positionInFile) {
    method print (line 173) | public void print(){

FILE: unrar/src/main/java/com/github/junrar/rarfile/BlockHeader.java
  class BlockHeader (line 33) | public class BlockHeader extends BaseBlock{
    method BlockHeader (line 41) | public BlockHeader(){
    method BlockHeader (line 45) | public BlockHeader(BlockHeader bh){
    method BlockHeader (line 52) | public BlockHeader(BaseBlock bb, byte[] blockHeader)
    method getDataSize (line 60) | public int getDataSize() {
    method getPackSize (line 64) | public int getPackSize() {
    method print (line 68) | public void print(){

FILE: unrar/src/main/java/com/github/junrar/rarfile/CommentHeader.java
  class CommentHeader (line 30) | public class CommentHeader extends BaseBlock {
    method CommentHeader (line 40) | public CommentHeader(BaseBlock bb, byte[] commentHeader){
    method getCommCRC (line 55) | public short getCommCRC() {
    method getUnpMethod (line 59) | public byte getUnpMethod() {
    method getUnpSize (line 63) | public short getUnpSize() {
    method getUnpVersion (line 67) | public byte getUnpVersion() {

FILE: unrar/src/main/java/com/github/junrar/rarfile/EAHeader.java
  class EAHeader (line 31) | public class EAHeader
    method EAHeader (line 43) | public EAHeader(SubBlockHeader sb, byte[] eahead)
    method getEACRC (line 59) | public int getEACRC() {
    method getMethod (line 66) | public byte getMethod() {
    method getUnpSize (line 73) | public int getUnpSize() {
    method getUnpVer (line 80) | public byte getUnpVer() {
    method print (line 84) | public void print()

FILE: unrar/src/main/java/com/github/junrar/rarfile/EndArcHeader.java
  class EndArcHeader (line 28) | public class EndArcHeader extends BaseBlock{
    method EndArcHeader (line 43) | public EndArcHeader(BaseBlock bb, byte[] endArcHeader){
    method getArchiveDataCRC (line 56) | public int getArchiveDataCRC() {
    method getVolumeNumber (line 60) | public short getVolumeNumber() {

FILE: unrar/src/main/java/com/github/junrar/rarfile/FileHeader.java
  class FileHeader (line 36) | public class FileHeader extends BlockHeader {
    method FileHeader (line 89) | public FileHeader(BlockHeader bh, byte[] fileHeader) {
    method print (line 197) | @Override
    method getDateDos (line 225) | private Date getDateDos(int time) {
    method getArcTime (line 236) | public Date getArcTime() {
    method setArcTime (line 240) | public void setArcTime(Date arcTime) {
    method getATime (line 244) | public Date getATime() {
    method setATime (line 248) | public void setATime(Date time) {
    method getCTime (line 252) | public Date getCTime() {
    method setCTime (line 256) | public void setCTime(Date time) {
    method getFileAttr (line 260) | public int getFileAttr() {
    method setFileAttr (line 264) | public void setFileAttr(int fileAttr) {
    method getFileCRC (line 268) | public int getFileCRC() {
    method getFileNameByteArray (line 272) | public byte[] getFileNameByteArray() {
    method getFileNameString (line 276) | public String getFileNameString() {
    method setFileName (line 280) | public void setFileName(String fileName) {
    method getFileNameW (line 284) | public String getFileNameW() {
    method setFileNameW (line 288) | public void setFileNameW(String fileNameW) {
    method getHighPackSize (line 292) | public int getHighPackSize() {
    method getHighUnpackSize (line 296) | public int getHighUnpackSize() {
    method getHostOS (line 300) | public HostSystem getHostOS() {
    method getMTime (line 304) | public Date getMTime() {
    method setMTime (line 308) | public void setMTime(Date time) {
    method getNameSize (line 312) | public short getNameSize() {
    method getRecoverySectors (line 316) | public int getRecoverySectors() {
    method getSalt (line 320) | public byte[] getSalt() {
    method getSubData (line 324) | public byte[] getSubData() {
    method getSubFlags (line 328) | public int getSubFlags() {
    method getUnpMethod (line 332) | public byte getUnpMethod() {
    method getUnpSize (line 336) | public long getUnpSize() {
    method getUnpVersion (line 340) | public byte getUnpVersion() {
    method getFullPackSize (line 344) | public long getFullPackSize() {
    method getFullUnpackSize (line 348) | public long getFullUnpackSize() {
    method toString (line 352) | @Override
    method isSplitAfter (line 362) | public boolean isSplitAfter() {
    method isSplitBefore (line 371) | public boolean isSplitBefore() {
    method isSolid (line 380) | public boolean isSolid() {
    method isEncrypted (line 389) | public boolean isEncrypted() {
    method isUnicode (line 398) | public boolean isUnicode() {
    method isFileHeader (line 402) | public boolean isFileHeader() {
    method hasSalt (line 406) | public boolean hasSalt() {
    method isLargeBlock (line 410) | public boolean isLargeBlock() {
    method isDirectory (line 419) | public boolean isDirectory() {

FILE: unrar/src/main/java/com/github/junrar/rarfile/FileNameDecoder.java
  class FileNameDecoder (line 21) | public class FileNameDecoder {
    method getChar (line 22) | public static int getChar(byte [] name,int pos){
    method decode (line 26) | public static String decode(byte [] name,int encPos){

FILE: unrar/src/main/java/com/github/junrar/rarfile/HostSystem.java
  type HostSystem (line 27) | public enum HostSystem {
    method findHostSystem (line 37) | public static HostSystem findHostSystem(byte hostByte){
    method HostSystem (line 60) | private HostSystem(byte hostByte){
    method equals (line 64) | public boolean equals(byte hostByte){
    method getHostByte (line 68) | public byte getHostByte(){

FILE: unrar/src/main/java/com/github/junrar/rarfile/MacInfoHeader.java
  class MacInfoHeader (line 31) | public class MacInfoHeader
    method MacInfoHeader (line 41) | public MacInfoHeader(SubBlockHeader sb, byte[] macHeader)
    method getFileCreator (line 53) | public int getFileCreator() {
    method setFileCreator (line 60) | public void setFileCreator(int fileCreator) {
    method getFileType (line 67) | public int getFileType() {
    method setFileType (line 74) | public void setFileType(int fileType) {
    method print (line 78) | public void print(){

FILE: unrar/src/main/java/com/github/junrar/rarfile/MainHeader.java
  class MainHeader (line 33) | public class MainHeader extends BaseBlock {
    method MainHeader (line 41) | public MainHeader(BaseBlock bb, byte[] mainHeader) {
    method hasArchCmt (line 58) | public boolean hasArchCmt(){
    method getEncryptVersion (line 65) | public byte getEncryptVersion() {
    method getHighPosAv (line 69) | public short getHighPosAv() {
    method getPosAv (line 73) | public int getPosAv() {
    method isEncrypted (line 81) | public boolean isEncrypted(){
    method isMultiVolume (line 89) | public boolean isMultiVolume(){
    method isFirstVolume (line 97) | public boolean isFirstVolume(){
    method print (line 101) | public void print(){
    method isSolid (line 122) | public boolean isSolid(){
    method isLocked (line 126) | public boolean isLocked(){
    method isProtected (line 130) | public boolean isProtected(){
    method isAV (line 134) | public boolean isAV(){
    method isNewNumbering (line 141) | public boolean isNewNumbering(){

FILE: unrar/src/main/java/com/github/junrar/rarfile/MarkHeader.java
  class MarkHeader (line 33) | public class MarkHeader extends BaseBlock {
    method MarkHeader (line 38) | public MarkHeader(BaseBlock bb){
    method isValid (line 41) | public boolean isValid(){
    method isSignature (line 57) | public boolean isSignature() {
    method isOldFormat (line 79) | public boolean isOldFormat() {
    method print (line 83) | public void print(){

FILE: unrar/src/main/java/com/github/junrar/rarfile/NewSubHeaderType.java
  class NewSubHeaderType (line 29) | public class NewSubHeaderType {
    method NewSubHeaderType (line 70) | private NewSubHeaderType(byte[] headerTypes)
    method byteEquals (line 79) | public boolean byteEquals(byte[] toCompare)
    method toString (line 84) | @Override

FILE: unrar/src/main/java/com/github/junrar/rarfile/ProtectHeader.java
  class ProtectHeader (line 29) | public class ProtectHeader extends BlockHeader {
    method ProtectHeader (line 42) | public ProtectHeader(BlockHeader bh, byte[] protectHeader){
    method getMark (line 56) | public byte getMark() {
    method getRecSectors (line 60) | public short getRecSectors() {
    method getTotalBlocks (line 64) | public int getTotalBlocks() {
    method getVersion (line 68) | public byte getVersion() {

FILE: unrar/src/main/java/com/github/junrar/rarfile/SignHeader.java
  class SignHeader (line 29) | public class SignHeader extends BaseBlock {
    method SignHeader (line 38) | public SignHeader(BaseBlock bb, byte[] signHeader){
    method getArcNameSize (line 49) | public short getArcNameSize() {
    method getCreationTime (line 53) | public int getCreationTime() {
    method getUserNameSize (line 57) | public short getUserNameSize() {

FILE: unrar/src/main/java/com/github/junrar/rarfile/SubBlockHeader.java
  class SubBlockHeader (line 27) | public class SubBlockHeader
    method SubBlockHeader (line 37) | public SubBlockHeader(SubBlockHeader sb)
    method SubBlockHeader (line 44) | public SubBlockHeader(BlockHeader bh, byte[] subblock)
    method getLevel (line 56) | public byte getLevel() {
    method getSubType (line 63) | public SubBlockHeaderType getSubType() {
    method print (line 67) | public void print()

FILE: unrar/src/main/java/com/github/junrar/rarfile/SubBlockHeaderType.java
  type SubBlockHeaderType (line 22) | public enum SubBlockHeaderType
    method SubBlockHeaderType (line 33) | private SubBlockHeaderType(short subblocktype)
    method equals (line 43) | public boolean equals(short subblocktype)
    method findSubblockHeaderType (line 53) | public static SubBlockHeaderType findSubblockHeaderType(short subType)
    method getSubblocktype (line 74) | public short getSubblocktype() {

FILE: unrar/src/main/java/com/github/junrar/rarfile/UnixOwnersHeader.java
  class UnixOwnersHeader (line 9) | public class UnixOwnersHeader
    method UnixOwnersHeader (line 18) | public  UnixOwnersHeader(SubBlockHeader sb, byte[] uoHeader) {
    method getGroup (line 40) | public String getGroup() {
    method setGroup (line 46) | public void setGroup(String group) {
    method getGroupNameSize (line 52) | public int getGroupNameSize() {
    method setGroupNameSize (line 58) | public void setGroupNameSize(int groupNameSize) {
    method getOwner (line 64) | public String getOwner() {
    method setOwner (line 70) | public void setOwner(String owner) {
    method getOwnerNameSize (line 76) | public int getOwnerNameSize() {
    method setOwnerNameSize (line 82) | public void setOwnerNameSize(int ownerNameSize) {
    method print (line 89) | public void print(){

FILE: unrar/src/main/java/com/github/junrar/rarfile/UnrarHeadertype.java
  type UnrarHeadertype (line 27) | public enum UnrarHeadertype {
    method findType (line 85) | public static UnrarHeadertype findType(byte headerType)
    method UnrarHeadertype (line 136) | private UnrarHeadertype(byte headerByte)
    method equals (line 147) | public boolean equals(byte header)
    method getHeaderByte (line 157) | public byte getHeaderByte() {

FILE: unrar/src/main/java/com/github/junrar/unpack/ComprDataIO.java
  class ComprDataIO (line 41) | public class ComprDataIO {
    method ComprDataIO (line 83) | public ComprDataIO(Archive arc) {
    method init (line 87) | public void init(OutputStream outputStream) {
    method init (line 108) | public void init(FileHeader hd) throws IOException {
    method unpRead (line 119) | public int unpRead(byte[] addr, int offset, int count) throws IOExcept...
    method unpWrite (line 176) | public void unpWrite(byte[] addr, int offset, int count) throws IOExce...
    method setPackedSizeToRead (line 198) | public void setPackedSizeToRead(long size) {
    method setTestMode (line 202) | public void setTestMode(boolean mode) {
    method setSkipUnpCRC (line 206) | public void setSkipUnpCRC(boolean skip) {
    method setSubHeader (line 210) | public void setSubHeader(FileHeader hd) {
    method getCurPackRead (line 215) | public long getCurPackRead() {
    method setCurPackRead (line 219) | public void setCurPackRead(long curPackRead) {
    method getCurPackWrite (line 223) | public long getCurPackWrite() {
    method setCurPackWrite (line 227) | public void setCurPackWrite(long curPackWrite) {
    method getCurUnpRead (line 231) | public long getCurUnpRead() {
    method setCurUnpRead (line 235) | public void setCurUnpRead(long curUnpRead) {
    method getCurUnpWrite (line 239) | public long getCurUnpWrite() {
    method setCurUnpWrite (line 243) | public void setCurUnpWrite(long curUnpWrite) {
    method getDecryption (line 247) | public int getDecryption() {
    method setDecryption (line 251) | public void setDecryption(int decryption) {
    method getEncryption (line 255) | public int getEncryption() {
    method setEncryption (line 259) | public void setEncryption(int encryption) {
    method isNextVolumeMissing (line 263) | public boolean isNextVolumeMissing() {
    method setNextVolumeMissing (line 267) | public void setNextVolumeMissing(boolean nextVolumeMissing) {
    method getPackedCRC (line 271) | public long getPackedCRC() {
    method setPackedCRC (line 275) | public void setPackedCRC(long packedCRC) {
    method getPackFileCRC (line 279) | public long getPackFileCRC() {
    method setPackFileCRC (line 283) | public void setPackFileCRC(long packFileCRC) {
    method isPackVolume (line 287) | public boolean isPackVolume() {
    method setPackVolume (line 291) | public void setPackVolume(boolean packVolume) {
    method getProcessedArcSize (line 295) | public long getProcessedArcSize() {
    method setProcessedArcSize (line 299) | public void setProcessedArcSize(long processedArcSize) {
    method getTotalArcSize (line 303) | public long getTotalArcSize() {
    method setTotalArcSize (line 307) | public void setTotalArcSize(long totalArcSize) {
    method getTotalPackRead (line 311) | public long getTotalPackRead() {
    method setTotalPackRead (line 315) | public void setTotalPackRead(long totalPackRead) {
    method getUnpArcSize (line 319) | public long getUnpArcSize() {
    method setUnpArcSize (line 323) | public void setUnpArcSize(long unpArcSize) {
    method getUnpFileCRC (line 327) | public long getUnpFileCRC() {
    method setUnpFileCRC (line 331) | public void setUnpFileCRC(long unpFileCRC) {
    method isUnpVolume (line 335) | public boolean isUnpVolume() {
    method setUnpVolume (line 339) | public void setUnpVolume(boolean unpVolume) {
    method getSubHeader (line 343) | public FileHeader getSubHeader() {

FILE: unrar/src/main/java/com/github/junrar/unpack/Unpack.java
  class Unpack (line 42) | public final class Unpack extends Unpack20 {
    method Unpack (line 85) | public Unpack(ComprDataIO DataIO) {
    method init (line 94) | public void init(byte[] window) {
    method doUnpack (line 105) | public void doUnpack(int method, boolean solid) throws IOException,
    method unstoreFile (line 125) | private void unstoreFile() throws IOException, RarException {
    method unpack29 (line 140) | private void unpack29(boolean solid) throws IOException, RarException {
    method UnpWriteBuf (line 359) | private void UnpWriteBuf() throws IOException {
    method UnpWriteArea (line 533) | private void UnpWriteArea(int startPtr, int endPtr) throws IOException {
    method UnpWriteData (line 546) | private void UnpWriteData(byte[] data, int offset, int size)
    method insertOldDist (line 562) | private void insertOldDist(int distance) {
    method insertLastMatch (line 569) | private void insertLastMatch(int length, int distance) {
    method copyString (line 574) | private void copyString(int length, int distance) {
    method unpInitData (line 594) | protected void unpInitData(boolean solid) {
    method initFilters (line 619) | private void initFilters() {
    method readEndOfBlock (line 628) | private boolean readEndOfBlock() throws IOException, RarException {
    method readTables (line 643) | private boolean readTables() throws IOException, RarException {
    method readVMCode (line 747) | private boolean readVMCode() throws IOException, RarException {
    method readVMCodePPM (line 769) | private boolean readVMCodePPM() throws IOException, RarException {
    method addVMCode (line 803) | private boolean addVMCode(int firstByte, List<Byte> vmCode, int length) {
    method ExecuteCode (line 982) | private void ExecuteCode(VMPreparedProgram Prg) {
    method isFileExtracted (line 1015) | public boolean isFileExtracted() {
    method setDestSize (line 1019) | public void setDestSize(long destSize) {
    method setSuspended (line 1024) | public void setSuspended(boolean suspended) {
    method getChar (line 1028) | public int getChar() throws IOException, RarException {
    method getPpmEscChar (line 1035) | public int getPpmEscChar() {
    method setPpmEscChar (line 1039) | public void setPpmEscChar(int ppmEscChar) {
    method cleanUp (line 1043) | public void cleanUp() {

FILE: unrar/src/main/java/com/github/junrar/unpack/Unpack15.java
  class Unpack15 (line 34) | public abstract class Unpack15 extends BitInput
    method unpInitData (line 137) | protected abstract void unpInitData(boolean solid);
    method unpack15 (line 139) | protected void unpack15(boolean solid) throws IOException, RarException
    method unpReadBuf (line 214) | protected boolean unpReadBuf() throws IOException, RarException
    method getShortLen1 (line 243) | private int getShortLen1(int pos)
    method getShortLen2 (line 248) | private int getShortLen2(int pos)
    method shortLZ (line 253) | protected void shortLZ()
    method longLZ (line 347) | protected void longLZ()
    method huffDecode (line 441) | protected void huffDecode()
    method getFlagsBuf (line 520) | protected void getFlagsBuf()
    method oldUnpInitData (line 539) | protected void oldUnpInitData(boolean Solid)
    method initHuff (line 554) | protected void initHuff()
    method corrHuff (line 570) | protected void corrHuff(int[] CharSet, int[] NumToPlace)
    method oldCopyString (line 585) | protected void oldCopyString(int Distance, int Length)
    method decodeNum (line 594) | protected int decodeNum(int Num, int StartPos, int[] DecTab, int[] Pos...
    method oldUnpWriteBuf (line 604) | protected void oldUnpWriteBuf() throws IOException

FILE: unrar/src/main/java/com/github/junrar/unpack/Unpack20.java
  class Unpack20 (line 42) | public abstract class Unpack20 extends Unpack15
    method unpack20 (line 84) | protected void unpack20(boolean solid) throws IOException, RarException
    method CopyString20 (line 203) | protected void CopyString20(int Length, int Distance)
    method makeDecodeTables (line 226) | protected void makeDecodeTables(byte[] lenTab, int offset, Decode dec,
    method decodeNumber (line 261) | protected int decodeNumber(Decode dec)
    method ReadTables20 (line 386) | protected boolean ReadTables20() throws IOException, RarException
    method unpInitData20 (line 469) | protected void unpInitData20(boolean Solid)
    method ReadLastTables (line 481) | protected void ReadLastTables() throws IOException, RarException
    method DecodeAudio (line 496) | protected byte DecodeAudio(int Delta)

FILE: unrar/src/main/java/com/github/junrar/unpack/UnpackFilter.java
  class UnpackFilter (line 28) | public class UnpackFilter {
    method getBlockLength (line 44) | public int getBlockLength() {
    method setBlockLength (line 48) | public void setBlockLength(int blockLength) {
    method getBlockStart (line 52) | public int getBlockStart() {
    method setBlockStart (line 56) | public void setBlockStart(int blockStart) {
    method getExecCount (line 60) | public int getExecCount() {
    method setExecCount (line 64) | public void setExecCount(int execCount) {
    method isNextWindow (line 68) | public boolean isNextWindow() {
    method setNextWindow (line 72) | public void setNextWindow(boolean nextWindow) {
    method getParentFilter (line 76) | public int getParentFilter() {
    method setParentFilter (line 80) | public void setParentFilter(int parentFilter) {
    method getPrg (line 84) | public VMPreparedProgram getPrg() {
    method setPrg (line 88) | public void setPrg(VMPreparedProgram prg) {

FILE: unrar/src/main/java/com/github/junrar/unpack/decode/AudioVariables.java
  class AudioVariables (line 26) | public class AudioVariables {
    method getByteCount (line 39) | public int getByteCount() {
    method setByteCount (line 43) | public void setByteCount(int byteCount) {
    method getD1 (line 47) | public int getD1() {
    method setD1 (line 51) | public void setD1(int d1) {
    method getD2 (line 55) | public int getD2() {
    method setD2 (line 59) | public void setD2(int d2) {
    method getD3 (line 63) | public int getD3() {
    method setD3 (line 67) | public void setD3(int d3) {
    method getD4 (line 71) | public int getD4() {
    method setD4 (line 75) | public void setD4(int d4) {
    method getDif (line 79) | public int[] getDif() {
    method setDif (line 83) | public void setDif(int[] dif) {
    method getK1 (line 87) | public int getK1() {
    method setK1 (line 91) | public void setK1(int k1) {
    method getK2 (line 95) | public int getK2() {
    method setK2 (line 99) | public void setK2(int k2) {
    method getK3 (line 103) | public int getK3() {
    method setK3 (line 107) | public void setK3(int k3) {
    method getK4 (line 111) | public int getK4() {
    method setK4 (line 115) | public void setK4(int k4) {
    method getK5 (line 119) | public int getK5() {
    method setK5 (line 123) | public void setK5(int k5) {
    method getLastChar (line 127) | public int getLastChar() {
    method setLastChar (line 131) | public void setLastChar(int lastChar) {
    method getLastDelta (line 135) | public int getLastDelta() {
    method setLastDelta (line 139) | public void setLastDelta(int lastDelta) {

FILE: unrar/src/main/java/com/github/junrar/unpack/decode/BitDecode.java
  class BitDecode (line 26) | public class BitDecode extends Decode
    method BitDecode (line 31) | public BitDecode()

FILE: unrar/src/main/java/com/github/junrar/unpack/decode/CodeType.java
  type CodeType (line 26) | public enum CodeType {

FILE: unrar/src/main/java/com/github/junrar/unpack/decode/Compress.java
  class Compress (line 26) | public class Compress {

FILE: unrar/src/main/java/com/github/junrar/unpack/decode/Decode.java
  class Decode (line 26) | public class Decode
    method getDecodeLen (line 40) | public int[] getDecodeLen()
    method getDecodeNum (line 49) | public int[] getDecodeNum()
    method getDecodePos (line 58) | public int[] getDecodePos()
    method getMaxNum (line 67) | public int getMaxNum()
    method setMaxNum (line 76) | public void setMaxNum(int maxNum)

FILE: unrar/src/main/java/com/github/junrar/unpack/decode/DistDecode.java
  class DistDecode (line 26) | public class DistDecode extends Decode
    method DistDecode (line 32) | public DistDecode()

FILE: unrar/src/main/java/com/github/junrar/unpack/decode/FilterType.java
  type FilterType (line 26) | public enum FilterType {

FILE: unrar/src/main/java/com/github/junrar/unpack/decode/LitDecode.java
  class LitDecode (line 26) | public class LitDecode extends Decode
    method LitDecode (line 31) | public LitDecode()

FILE: unrar/src/main/java/com/github/junrar/unpack/decode/LowDistDecode.java
  class LowDistDecode (line 26) | public class LowDistDecode extends Decode
    method LowDistDecode (line 32) | public LowDistDecode()

FILE: unrar/src/main/java/com/github/junrar/unpack/decode/MultDecode.java
  class MultDecode (line 26) | public class MultDecode extends Decode
    method MultDecode (line 32) | public MultDecode()

FILE: unrar/src/main/java/com/github/junrar/unpack/decode/RepDecode.java
  class RepDecode (line 26) | public class RepDecode extends Decode
    method RepDecode (line 31) | public RepDecode()

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/AnalyzeHeapDump.java
  class AnalyzeHeapDump (line 14) | public class AnalyzeHeapDump {
    method AnalyzeHeapDump (line 17) | public AnalyzeHeapDump() {
    method main (line 20) | public static void main(String[] argv) {
    method printMismatch (line 89) | private static void printMismatch(long startOff, long bytesRead) {

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/BlockTypes.java
  type BlockTypes (line 27) | public enum BlockTypes
    method BlockTypes (line 33) | private BlockTypes(int blockType)
    method getBlockType (line 38) | public int getBlockType()
    method equals (line 43) | public boolean equals(int blockType)
    method findBlockType (line 48) | public static BlockTypes findBlockType(int blockType)

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/FreqData.java
  class FreqData (line 28) | public class FreqData extends Pointer{
    method FreqData (line 38) | public FreqData(byte[]mem){
    method init (line 42) | public FreqData init(byte[] mem) {
    method getSummFreq (line 48) | public int getSummFreq() {
    method setSummFreq (line 52) | public void setSummFreq(int summFreq) {
    method incSummFreq (line 56) | public void incSummFreq(int dSummFreq) {
    method getStats (line 60) | public int getStats() {
    method setStats (line 64) | public void setStats(State state) {
    method setStats (line 68) | public void setStats(int state) {
    method toString (line 72) | public String toString() {

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/ModelPPM.java
  class ModelPPM (line 33) | public class ModelPPM
    method ModelPPM (line 92) | public ModelPPM()
    method getSubAlloc (line 99) | public SubAllocator getSubAlloc()
    method restartModelRare (line 104) | private void restartModelRare()
    method startModelRare (line 146) | private void startModelRare(int MaxOrder)
    method clearMask (line 181) | private void clearMask()
    method decodeInit (line 187) | public boolean decodeInit(Unpack unpackRead, int escChar/* ref */)
    method decodeChar (line 232) | public int decodeChar() throws IOException, RarException
    method getSEE2Cont (line 286) | public SEE2Context[][] getSEE2Cont()
    method getDummySEE2Cont (line 291) | public SEE2Context getDummySEE2Cont()
    method getInitRL (line 296) | public int getInitRL()
    method setEscCount (line 301) | public void setEscCount(int escCount)
    method getEscCount (line 306) | public int getEscCount()
    method incEscCount (line 311) | public void incEscCount(int dEscCount) {
    method getCharMask (line 315) | public int[] getCharMask()
    method getNumMasked (line 320) | public int getNumMasked()
    method setNumMasked (line 325) | public void setNumMasked(int numMasked)
    method setPrevSuccess (line 330) | public void setPrevSuccess(int prevSuccess)
    method getInitEsc (line 335) | public int getInitEsc()
    method setInitEsc (line 340) | public void setInitEsc(int initEsc)
    method setRunLength (line 345) | public void setRunLength(int runLength)
    method getRunLength (line 350) | public int getRunLength()
    method incRunLength (line 355) | public void incRunLength(int dRunLength) {
    method getPrevSuccess (line 359) | public int getPrevSuccess()
    method getHiBitsFlag (line 364) | public int getHiBitsFlag()
    method setHiBitsFlag (line 369) | public void setHiBitsFlag(int hiBitsFlag)
    method getBinSumm (line 374) | public int[][] getBinSumm()
    method getCoder (line 379) | public RangeCoder getCoder()
    method getHB2Flag (line 384) | public int[] getHB2Flag()
    method getNS2BSIndx (line 389) | public int[] getNS2BSIndx()
    method getNS2Indx (line 394) | public int[] getNS2Indx()
    method getFoundState (line 399) | public State getFoundState()
    method getHeap (line 404) | public byte[] getHeap()
    method getOrderFall (line 409) | public int getOrderFall()
    method createSuccessors (line 414) | private int /* ppmcontext ptr */createSuccessors(boolean Skip,
    method updateModelRestart (line 504) | private void updateModelRestart()
    method updateModel (line 510) | private void updateModel()
    method toString (line 663) | public String toString() {

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/PPMContext.java
  class PPMContext (line 28) | public class PPMContext extends Pointer
    method PPMContext (line 59) | public PPMContext(byte[] mem)
    method init (line 66) | public PPMContext init(byte[] mem) {
    method getFreqData (line 74) | public FreqData getFreqData()
    method setFreqData (line 79) | public void setFreqData(FreqData freqData)
    method getNumStats (line 85) | public final int getNumStats()
    method setNumStats (line 93) | public final void setNumStats(int numStats)
    method getOneState (line 101) | public State getOneState()
    method setOneState (line 106) | public void setOneState(StateRef oneState)
    method getSuffix (line 111) | public int getSuffix()
    method setSuffix (line 119) | public void setSuffix(PPMContext suffix)
    method setSuffix (line 124) | public void setSuffix(int suffix)
    method setAddress (line 132) | @Override
    method getTempPPMContext (line 140) | private PPMContext getTempPPMContext(byte[] mem) {
    method createChild (line 147) | public int createChild(ModelPPM model, State pStats/* ptr */,
    method rescale (line 161) | public void rescale(ModelPPM model)
    method getArrayIndex (line 236) | private int getArrayIndex(ModelPPM Model, State rs)
    method getMean (line 248) | public int getMean(int summ, int shift, int round)
    method decodeBinSymbol (line 253) | public void decodeBinSymbol(ModelPPM model)
    method update1 (line 299) | public void update1(ModelPPM model, int p/* ptr */)
    method decodeSymbol2 (line 316) | public boolean decodeSymbol2(ModelPPM model)
    method update2 (line 367) | public void update2(ModelPPM model, int p/* state ptr */)
    method makeEscFreq2 (line 381) | private SEE2Context makeEscFreq2(ModelPPM model, int Diff)
    method decodeSymbol1 (line 403) | public boolean decodeSymbol1(ModelPPM model)
    method toString (line 458) | public String toString() {

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/Pointer.java
  class Pointer (line 26) | public abstract class Pointer
    method Pointer (line 35) | public Pointer(byte[] mem){
    method getAddress (line 42) | public int getAddress(){
    method setAddress (line 54) | public void setAddress(int pos) {

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/RangeCoder.java
  class RangeCoder (line 32) | public class RangeCoder
    method getSubRange (line 47) | public SubRange getSubRange()
    method initDecoder (line 52) | public void initDecoder(Unpack unpackRead) throws IOException, RarExce...
    method getCurrentCount (line 63) | public int getCurrentCount()
    method getCurrentShiftCount (line 69) | public long getCurrentShiftCount(int SHIFT)
    method decode (line 75) | public void decode()
    method getChar (line 81) | private int getChar() throws IOException, RarException
    method ariDecNormalize (line 86) | public void ariDecNormalize() throws IOException, RarException
    method toString (line 109) | public String toString() {
    class SubRange (line 124) | public static class SubRange
      method getHighCount (line 129) | public long getHighCount()
      method setHighCount (line 134) | public void setHighCount(long highCount)
      method getLowCount (line 139) | public long getLowCount()
      method setLowCount (line 144) | public void setLowCount(long lowCount)
      method getScale (line 149) | public long getScale()
      method setScale (line 154) | public void setScale(long scale)
      method incScale (line 159) | public void incScale(int dScale) {
      method toString (line 164) | public String toString() {

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/RarMemBlock.java
  class RarMemBlock (line 30) | public class RarMemBlock extends Pointer
    method RarMemBlock (line 39) | public RarMemBlock(byte[] mem)
    method insertAt (line 44) | public void insertAt(RarMemBlock p)
    method remove (line 55) | public void remove()
    method getNext (line 66) | public int getNext()
    method setNext (line 74) | public void setNext(RarMemBlock next)
    method setNext (line 79) | public void setNext(int next)
    method getNU (line 87) | public int getNU()
    method setNU (line 95) | public void setNU(int nu)
    method getPrev (line 103) | public int getPrev()
    method setPrev (line 111) | public void setPrev(RarMemBlock prev)
    method setPrev (line 116) | public void setPrev(int prev)
    method getStamp (line 124) | public int getStamp()
    method setStamp (line 132) | public void setStamp(int stamp)

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/RarNode.java
  class RarNode (line 30) | public class RarNode extends Pointer{
    method RarNode (line 35) | public RarNode(byte[] mem){
    method getNext (line 39) | public int getNext() {
    method setNext (line 46) | public void setNext(RarNode next) {
    method setNext (line 50) | public void setNext(int next) {
    method toString (line 57) | public String toString() {

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/SEE2Context.java
  class SEE2Context (line 26) | public class SEE2Context {
    method init (line 38) | public void init(int initVal) {
    method getMean (line 44) | public int getMean() {
    method update (line 50) | public void update() {
    method getCount (line 60) | public int getCount() {
    method setCount (line 64) | public void setCount(int count) {
    method getShift (line 68) | public int getShift() {
    method setShift (line 72) | public void setShift(int shift) {
    method getSumm (line 76) | public int getSumm() {
    method setSumm (line 80) | public void setSumm(int summ) {
    method incSumm (line 84) | public void incSumm(int dSumm) {
    method toString (line 88) | public String toString() {

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/State.java
  class State (line 28) | public class State extends Pointer {
    method State (line 32) | public State(byte[] mem) {
    method init (line 36) | public State init(byte[] mem) {
    method getSymbol (line 42) | public int getSymbol() {
    method setSymbol (line 46) | public void setSymbol(int symbol) {
    method getFreq (line 50) | public int getFreq() {
    method setFreq (line 54) | public void setFreq(int freq) {
    method incFreq (line 58) | public void incFreq(int dFreq) {
    method getSuccessor (line 62) | public int getSuccessor() {
    method setSuccessor (line 66) | public void setSuccessor(PPMContext successor) {
    method setSuccessor (line 70) | public void setSuccessor(int successor) {
    method setValues (line 74) | public void setValues(StateRef state){
    method setValues (line 80) | public void setValues(State ptr){
    method decAddress (line 84) | public State decAddress(){
    method incAddress (line 89) | public State incAddress(){
    method ppmdSwap (line 94) | public static void ppmdSwap(State ptr1, State ptr2) {
    method toString (line 103) | public String toString() {

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/StateRef.java
  class StateRef (line 27) | public class StateRef {
    method StateRef (line 35) | public StateRef() {
    method getSymbol (line 38) | public int getSymbol() {
    method setSymbol (line 42) | public void setSymbol(int symbol) {
    method getFreq (line 46) | public int getFreq() {
    method setFreq (line 50) | public void setFreq(int freq) {
    method incFreq (line 54) | public void incFreq(int dFreq) {
    method decFreq (line 58) | public void decFreq(int dFreq) {
    method setValues (line 62) | public void setValues(State statePtr){
    method getSuccessor (line 68) | public int getSuccessor() {
    method setSuccessor (line 72) | public void setSuccessor(PPMContext successor) {
    method setSuccessor (line 76) | public void setSuccessor(int successor) {
    method toString (line 80) | public String toString() {

FILE: unrar/src/main/java/com/github/junrar/unpack/ppm/SubAllocator.java
  class SubAllocator (line 28) | public class SubAllocator {
    method SubAllocator (line 66) | public SubAllocator() {
    method clean (line 70) | public void clean() {
    method insertNode (line 74) | private void insertNode(int p/* rarnode ptr */, int indx) {
    method incPText (line 81) | public void incPText() {
    method removeNode (line 85) | private int removeNode(int indx) {
    method U2B (line 93) | private int U2B(int NU) {
    method MBPtr (line 98) | private int MBPtr(int BasePtr, int Items) {
    method splitBlock (line 102) | private void splitBlock(int pv/* ptr */, int oldIndx, int newIndx) {
    method stopSubAllocator (line 113) | public void stopSubAllocator() {
    method GetAllocatedMemory (line 127) | public int GetAllocatedMemory() {
    method startSubAllocator (line 131) | public boolean startSubAllocator(int SASize) {
    method glueFreeBlocks (line 170) | private void glueFreeBlocks() {
    method allocUnitsRare (line 216) | private int allocUnitsRare(int indx) {
    method allocUnits (line 243) | public int allocUnits(int NU) {
    method allocContext (line 257) | public int allocContext() {
    method expandUnits (line 266) | public int expandUnits(int oldPtr, int OldNU) {
    method shrinkUnits (line 281) | public int shrinkUnits(int oldPtr, int oldNU, int newNU) {
    method freeUnits (line 304) | public void freeUnits(int ptr, int OldNU) {
    method getFakeUnitsStart (line 308) | public int getFakeUnitsStart() {
    method setFakeUnitsStart (line 312) | public void setFakeUnitsStart(int fakeUnitsStart) {
    method getHeapEnd (line 316) | public int getHeapEnd() {
    method getPText (line 320) | public int getPText() {
    method setPText (line 324) | public void setPText(int text) {
    method decPText (line 328) | public void decPText(int dPText) {
    method getUnitsStart (line 332) | public int getUnitsStart() {
    method setUnitsStart (line 336) | public void setUnitsStart(int unitsStart) {
    method initSubAllocator (line 340) | public void initSubAllocator() {
    method sizeOfFreeList (line 379) | private int sizeOfFreeList() {
    method getHeap (line 383) | public byte[] getHeap() {
    method toString (line 406) | public String toString() {

FILE: unrar/src/main/java/com/github/junrar/unpack/vm/BitInput.java
  class BitInput (line 26) | public class BitInput {
    method InitBitInput (line 38) | public void InitBitInput()
    method addbits (line 46) | public void addbits(int Bits)
    method getbits (line 56) | public int getbits()
    method BitInput (line 72) | public BitInput()
    method faddbits (line 80) | public void faddbits(int Bits)
    method fgetbits (line 89) | public int fgetbits()
    method Overflow (line 99) | public boolean Overflow(int IncPtr) {
    method getInBuf (line 102) | public byte[] getInBuf()

FILE: unrar/src/main/java/com/github/junrar/unpack/vm/RarVM.java
  class RarVM (line 33) | public class RarVM extends BitInput {
    method RarVM (line 61) | public RarVM() {
    method init (line 65) | public void init() {
    method isVMMem (line 71) | private boolean isVMMem(byte[] mem) {
    method getValue (line 75) | private int getValue(boolean byteMode, byte[] mem, int offset) {
    method setValue (line 92) | private void setValue(boolean byteMode, byte[] mem, int offset, int va...
    method setLowEndianValue (line 119) | public void setLowEndianValue(byte[] mem, int offset, int value) {
    method setLowEndianValue (line 126) | public void setLowEndianValue(Vector<Byte> mem, int offset, int value) {
    method getOperand (line 132) | private int getOperand(VMPreparedOperand cmdOp) {
    method execute (line 144) | public void execute(VMPreparedProgram prg) {
    method getMem (line 206) | public byte[] getMem()
    method setIP (line 211) | private boolean setIP(int ip) {
    method ExecuteCode (line 224) | private boolean ExecuteCode(List<VMPreparedCommand> preparedCode,
    method prepare (line 634) | public void prepare(byte[] code, int codeSize, VMPreparedProgram prg) {
    method decodeArg (line 766) | private void decodeArg(VMPreparedOperand op, boolean byteMode) {
    method optimize (line 806) | private void optimize(VMPreparedProgram prg) {
    method ReadData (line 865) | public static int ReadData(BitInput rarVM) {
    method IsStandardFilter (line 895) | private VMStandardFilters IsStandardFilter(byte[] code, int codeSize) {
    method ExecuteStandardFilter (line 915) | private void ExecuteStandardFilter(VMStandardFilters filterType) {
    method filterItanium_SetBits (line 1175) | private void filterItanium_SetBits(int curPos, int bitField, int bitPo...
    method filterItanium_GetBits (line 1193) | private int filterItanium_GetBits(int curPos, int bitPos, int bitCount) {
    method setMemory (line 1205) | public void setMemory(int pos,byte[] data,int offset,int dataSize)

FILE: unrar/src/main/java/com/github/junrar/unpack/vm/VMCmdFlags.java
  class VMCmdFlags (line 26) | public class VMCmdFlags {

FILE: unrar/src/main/java/com/github/junrar/unpack/vm/VMCommands.java
  type VMCommands (line 26) | public enum VMCommands {
    method VMCommands (line 46) | private VMCommands(int vmCommand) {
    method getVMCommand (line 50) | public int getVMCommand() {
    method equals (line 54) | public boolean equals(int vmCommand) {
    method findVMCommand (line 58) | public static VMCommands findVMCommand(int vmCommand) {

FILE: unrar/src/main/java/com/github/junrar/unpack/vm/VMFlags.java
  type VMFlags (line 26) | public enum VMFlags {
    method VMFlags (line 42) | private VMFlags(int flag){
    method findFlag (line 51) | public static VMFlags findFlag(int flag){
    method equals (line 69) | public boolean equals(int flag){
    method getFlag (line 75) | public int getFlag() {

FILE: unrar/src/main/java/com/github/junrar/unpack/vm/VMOpType.java
  type VMOpType (line 26) | public enum VMOpType {
    method VMOpType (line 34) | private VMOpType(int opType){
    method getOpType (line 38) | public int getOpType() {
    method equals (line 43) | public boolean equals(int opType){
    method findOpType (line 46) | public static VMOpType findOpType(int opType){

FILE: unrar/src/main/java/com/github/junrar/unpack/vm/VMPreparedCommand.java
  class VMPreparedCommand (line 26) | public class VMPreparedCommand {
    method isByteMode (line 32) | public boolean isByteMode() {
    method setByteMode (line 35) | public void setByteMode(boolean byteMode) {
    method getOp1 (line 38) | public VMPreparedOperand getOp1() {
    method setOp1 (line 41) | public void setOp1(VMPreparedOperand op1) {
    method getOp2 (line 44) | public VMPreparedOperand getOp2() {
    method setOp2 (line 47) | public void setOp2(VMPreparedOperand op2) {
    method getOpCode (line 50) | public VMCommands getOpCode() {
    method setOpCode (line 53) | public void setOpCode(VMCommands opCode) {

FILE: unrar/src/main/java/com/github/junrar/unpack/vm/VMPreparedOperand.java
  class VMPreparedOperand (line 26) | public class VMPreparedOperand {
    method getBase (line 33) | public int getBase() {
    method setBase (line 36) | public void setBase(int base) {
    method getData (line 39) | public int getData() {
    method setData (line 42) | public void setData(int data) {
    method getType (line 45) | public VMOpType getType() {
    method setType (line 48) | public void setType(VMOpType type) {
    method getOffset (line 51) | public int getOffset() {
    method setOffset (line 54) | public void setOffset(int offset) {

FILE: unrar/src/main/java/com/github/junrar/unpack/vm/VMPreparedProgram.java
  class VMPreparedProgram (line 30) | public class VMPreparedProgram
    method VMPreparedProgram (line 45) | public VMPreparedProgram()
    method getAltCmd (line 52) | public List<VMPreparedCommand> getAltCmd() {
    method setAltCmd (line 58) | public void setAltCmd(List<VMPreparedCommand> altCmd) {
    method getCmd (line 64) | public List<VMPreparedCommand> getCmd() {
    method setCmd (line 68) | public void setCmd(List<VMPreparedCommand> cmd) {
    method getCmdCount (line 72) | public int getCmdCount() {
    method setCmdCount (line 76) | public void setCmdCount(int cmdCount) {
    method getFilteredDataOffset (line 82) | public int getFilteredDataOffset() {
    method setFilteredDataOffset (line 88) | public void setFilteredDataOffset(int filteredDataOffset) {
    method getFilteredDataSize (line 94) | public int getFilteredDataSize() {
    method setFilteredDataSize (line 98) | public void setFilteredDataSize(int filteredDataSize) {
    method getGlobalData (line 102) | public Vector<Byte> getGlobalData() {
    method setGlobalData (line 106) | public void setGlobalData(Vector<Byte> globalData) {
    method getInitR (line 110) | public int[] getInitR() {
    method setInitR (line 114) | public void setInitR(int[] initR) {
    method getStaticData (line 118) | public Vector<Byte> getStaticData() {
    method setStaticData (line 122) | public void setStaticData(Vector<Byte> staticData) {

FILE: unrar/src/main/java/com/github/junrar/unpack/vm/VMStandardFilterSignature.java
  class VMStandardFilterSignature (line 26) | public class VMStandardFilterSignature {
    method VMStandardFilterSignature (line 33) | public VMStandardFilterSignature(int length, int crc, VMStandardFilter...
    method getCRC (line 40) | public int getCRC() {
    method setCRC (line 44) | public void setCRC(int crc) {
    method getLength (line 48) | public int getLength() {
    method setLength (line 52) | public void setLength(int length) {
    method getType (line 56) | public VMStandardFilters getType() {
    method setType (line 60) | public void setType(VMStandardFilters type) {

FILE: unrar/src/main/java/com/github/junrar/unpack/vm/VMStandardFilters.java
  type VMStandardFilters (line 26) | public enum VMStandardFilters {
    method VMStandardFilters (line 38) | private VMStandardFilters(int filter){
    method getFilter (line 42) | public int getFilter() {
    method equals (line 46) | public boolean equals(int filter){
    method findFilter (line 50) | public static VMStandardFilters findFilter(int filter){

FILE: unrar/src/main/java/com/github/junrar/unsigned/UnsignedByte.java
  class UnsignedByte (line 29) | public class UnsignedByte {
    method longToByte (line 31) | public static byte longToByte(long unsignedByte1){
    method intToByte (line 34) | public static byte intToByte(int unsignedByte1){
    method shortToByte (line 37) | public static byte shortToByte(short unsignedByte1){
    method add (line 42) | public static short add(byte unsignedByte1, byte unsignedByte2){
    method sub (line 46) | public static short sub(byte unsignedByte1, byte unsignedByte2){
    method main (line 52) | public static void main(String[] args)

FILE: unrar/src/main/java/com/github/junrar/unsigned/UnsignedInteger.java
  class UnsignedInteger (line 27) | public class UnsignedInteger {

FILE: unrar/src/main/java/com/github/junrar/unsigned/UnsignedLong.java
  class UnsignedLong (line 27) | public class UnsignedLong {

FILE: unrar/src/main/java/com/github/junrar/unsigned/UnsignedShort.java
  class UnsignedShort (line 27) | public class UnsignedShort {

FILE: unrar/src/main/java/com/github/junrar/util/VolumeHelper.java
  class VolumeHelper (line 7) | public class VolumeHelper {
    method VolumeHelper (line 8) | private VolumeHelper() {
    method nextVolumeName (line 40) | public static String nextVolumeName(String arcName, boolean oldNumberi...
    method isDigit (line 98) | private static boolean isDigit(char c) {

FILE: unrar/src/main/java/com/github/junrar/vfs2/provider/rar/RARFileObject.java
  class RARFileObject (line 38) | public class RARFileObject extends AbstractFileObject implements FileObj...
    method RARFileObject (line 49) | protected RARFileObject(AbstractFileName name, Archive archive,
    method doIsWriteable (line 58) | @Override
    method doGetType (line 63) | @Override
    method doListChildren (line 72) | @Override
    method doGetContentSize (line 85) | @Override
    method doGetLastModifiedTime (line 90) | @Override
    method doGetInputStream (line 95) | @Override
    method attachChild (line 110) | public void attachChild(FileName childName) {
    method setHeader (line 117) | public void setHeader(FileHeader header) {

FILE: unrar/src/main/java/com/github/junrar/vfs2/provider/rar/RARFileProvider.java
  class RARFileProvider (line 40) | public class RARFileProvider extends AbstractLayeredFileProvider implements
    method RARFileProvider (line 54) | public RARFileProvider() {
    method doCreateFileSystem (line 68) | @Override
    method getCapabilities (line 77) | public Collection<Capability> getCapabilities() {

FILE: unrar/src/main/java/com/github/junrar/vfs2/provider/rar/RARFileSystem.java
  class RARFileSystem (line 45) | public class RARFileSystem extends AbstractFileSystem implements FileSys...
    method RARFileSystem (line 51) | public RARFileSystem(final AbstractFileName rootName,
    method init (line 59) | @Override
    method createRARFileObject (line 117) | protected RARFileObject createRARFileObject(final AbstractFileName name,
    method doCloseCommunicationLink (line 122) | @Override
    method addCapabilities (line 136) | @Override
    method createFile (line 144) | @Override
    method notifyAllStreamsClosed (line 160) | protected void notifyAllStreamsClosed() {

FILE: unrar/src/main/java/com/github/junrar/vfs2/provider/rar/RandomAccessContentAccess.java
  class RandomAccessContentAccess (line 33) | public class RandomAccessContentAccess implements IReadOnlyAccess {
    method RandomAccessContentAccess (line 39) | public RandomAccessContentAccess(RandomAccessContent rac) {
    method RandomAccessContentAccess (line 47) | public RandomAccessContentAccess(FileObject file)
    method getPosition (line 52) | public long getPosition() throws IOException {
    method setPosition (line 56) | public void setPosition(long pos) throws IOException {
    method read (line 60) | public int read() throws IOException {
    method read (line 64) | public int read(byte[] buffer, int off, int count) throws IOException {
    method readFully (line 68) | public int readFully(byte[] buffer, int count) throws IOException {
    method close (line 72) | public void close() throws IOException {

FILE: unrar/src/main/java/com/github/junrar/vfs2/provider/rar/VFSVolume.java
  class VFSVolume (line 35) | public class VFSVolume implements Volume {
    method VFSVolume (line 43) | public VFSVolume(Archive archive, FileObject file) {
    method getReadOnlyAccess (line 48) | @Override
    method getLength (line 62) | @Override
    method getArchive (line 71) | @Override
    method getFile (line 79) | public FileObject getFile() {

FILE: unrar/src/main/java/com/github/junrar/vfs2/provider/rar/VFSVolumeManager.java
  class VFSVolumeManager (line 32) | public class VFSVolumeManager implements VolumeManager {
    method VFSVolumeManager (line 38) | public VFSVolumeManager(FileObject firstVolume) {
    method nextArchive (line 42) | @Override
Condensed preview — 98 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (408K chars).
[
  {
    "path": ".gitignore",
    "chars": 39,
    "preview": ".classpath\n.project\n.settings/\ntarget/\n"
  },
  {
    "path": "license.txt",
    "chars": 1861,
    "preview": " ******    *****   ******   UnRAR - free utility for RAR archives\n **   **  **   **  **   **  ~~~~~~~~~~~~~~~~~~~~~~~~~~"
  },
  {
    "path": "testutil/.gitignore",
    "chars": 37,
    "preview": ".classpath\n.project\nbin/\n.checkstyle\n"
  },
  {
    "path": "testutil/pom.xml",
    "chars": 1741,
    "preview": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\txsi:schemaLoc"
  },
  {
    "path": "testutil/src/main/java/com/github/junrar/testutil/ExtractArchive.java",
    "chars": 4300,
    "preview": "package com.github.junrar.testutil;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\ni"
  },
  {
    "path": "testutil/src/main/java/com/github/junrar/testutil/JUnRarTestUtil.java",
    "chars": 5513,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: EW\r\n * Creation date: "
  },
  {
    "path": "testutil/src/main/resources/META-INF/MANIFEST.MF",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "unrar/.gitignore",
    "chars": 21,
    "preview": ".classpath\n.project\n\n"
  },
  {
    "path": "unrar/generate-testdata.sh",
    "chars": 1377,
    "preview": "\nmode=$1\nadstepping=$2\nt1stepping=$3\nt2stepping=$4\nindir=$5\noutdir=$6\npar1=1\npar2=1\npath=$PWD\n\n\nfunction start {\ncase \"$"
  },
  {
    "path": "unrar/pom.xml",
    "chars": 3002,
    "preview": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocat"
  },
  {
    "path": "unrar/readme.md",
    "chars": 153,
    "preview": "unrar\r\n=====\r\n\r\nAdds support to read a rar from a given InputStream.\r\n\r\nAdditional dependencies\r\n-----------------------"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/Archive.java",
    "chars": 16254,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/MVTest.java",
    "chars": 1502,
    "preview": "package com.github.junrar;\n\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\n"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/UnrarCallback.java",
    "chars": 452,
    "preview": "package com.github.junrar;\r\n\r\n\r\n/**\r\n *\r\n * @author alban\r\n */\r\npublic interface UnrarCallback {\r\n\r\n    /**\r\n     * Retu"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/Volume.java",
    "chars": 1147,
    "preview": "/*\n * This file is part of seedbox <github.com/seedbox>.\n *\n * seedbox is free software: you can redistribute it and/or "
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/VolumeManager.java",
    "chars": 939,
    "preview": "/*\n * This file is part of seedbox <github.com/seedbox>.\n *\n * seedbox is free software: you can redistribute it and/or "
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/crc/RarCRC.java",
    "chars": 4096,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/crypt/Rijndael.java",
    "chars": 718,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/exception/RarException.java",
    "chars": 1531,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/impl/FileVolume.java",
    "chars": 1559,
    "preview": "/*\n * This file is part of seedbox <github.com/seedbox>.\n *\n * seedbox is free software: you can redistribute it and/or "
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/impl/FileVolumeManager.java",
    "chars": 1684,
    "preview": "/*\n * This file is part of seedbox <github.com/seedbox>.\n *\n * seedbox is free software: you can redistribute it and/or "
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/io/IReadOnlyAccess.java",
    "chars": 1635,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/io/InputStreamReadOnlyAccessFile.java",
    "chars": 1240,
    "preview": "package com.github.junrar.io;\r\n\r\nimport java.io.BufferedInputStream;\r\nimport java.io.IOException;\r\nimport java.io.InputS"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/io/RandomAccessStream.java",
    "chars": 4582,
    "preview": "/*\n * public domain as of http://rsbweb.nih.gov/ij/disclaimer.html\n */\npackage com.github.junrar.io;\n\nimport java.io.*;\n"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/io/Raw.java",
    "chars": 8406,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/io/ReadOnlyAccessByteArray.java",
    "chars": 2474,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/io/ReadOnlyAccessFile.java",
    "chars": 1448,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/io/ReadOnlyAccessInputStream.java",
    "chars": 1993,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/AVHeader.java",
    "chars": 1473,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/BaseBlock.java",
    "chars": 5270,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/BlockHeader.java",
    "chars": 1792,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/CommentHeader.java",
    "chars": 1458,
    "preview": "/*\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\n * Original author: Edmund Wagner\n * Creatio"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/EAHeader.java",
    "chars": 1774,
    "preview": "/*\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\n * Original author: Edmund Wagner\n * Creatio"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/EndArcHeader.java",
    "chars": 1628,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/FileHeader.java",
    "chars": 9653,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/FileNameDecoder.java",
    "chars": 1925,
    "preview": "/*\n * \n * Original author: alpha_lam\n * Creation date: ?\n *\n * Source: $HeadURL$\n * Last changed: $LastChangedDate$\n * \n"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/HostSystem.java",
    "chars": 1662,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/MacInfoHeader.java",
    "chars": 1744,
    "preview": "/*\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\n * Original author: Edmund Wagner\n * Creatio"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/MainHeader.java",
    "chars": 3756,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/MarkHeader.java",
    "chars": 2273,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/NewSubHeaderType.java",
    "chars": 2533,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/ProtectHeader.java",
    "chars": 1548,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/SignHeader.java",
    "chars": 1428,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/SubBlockHeader.java",
    "chars": 1572,
    "preview": "/*\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\n * Original author: Edmund Wagner\n * Creatio"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/SubBlockHeaderType.java",
    "chars": 1884,
    "preview": "/*\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\n * Original author: Edmund Wagner\n * Creatio"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/UnixOwnersHeader.java",
    "chars": 2213,
    "preview": "package com.github.junrar.rarfile;\n\nimport org.apache.commons.logging.Log;\nimport org.apache.commons.logging.LogFactory;"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/rarfile/UnrarHeadertype.java",
    "chars": 3378,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ComprDataIO.java",
    "chars": 8070,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/Unpack.java",
    "chars": 29925,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/Unpack15.java",
    "chars": 14911,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/Unpack20.java",
    "chars": 15597,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/UnpackFilter.java",
    "chars": 1982,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/decode/AudioVariables.java",
    "chars": 2254,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/decode/BitDecode.java",
    "chars": 831,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/decode/CodeType.java",
    "chars": 843,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/decode/Compress.java",
    "chars": 1505,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/decode/Decode.java",
    "chars": 1574,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/decode/DistDecode.java",
    "chars": 837,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/decode/FilterType.java",
    "chars": 890,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/decode/LitDecode.java",
    "chars": 833,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/decode/LowDistDecode.java",
    "chars": 844,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/decode/MultDecode.java",
    "chars": 839,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/decode/RepDecode.java",
    "chars": 833,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/AnalyzeHeapDump.java",
    "chars": 2923,
    "preview": "package com.github.junrar.unpack.ppm;\r\n\r\nimport java.io.BufferedInputStream;\r\nimport java.io.File;\r\nimport java.io.FileI"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/BlockTypes.java",
    "chars": 1221,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/FreqData.java",
    "chars": 2158,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/ModelPPM.java",
    "chars": 18528,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/PPMContext.java",
    "chars": 14266,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/Pointer.java",
    "chars": 1567,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/RangeCoder.java",
    "chars": 4369,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/RarMemBlock.java",
    "chars": 2788,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/RarNode.java",
    "chars": 1630,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/SEE2Context.java",
    "chars": 2285,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/State.java",
    "chars": 2869,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/StateRef.java",
    "chars": 2076,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/ppm/SubAllocator.java",
    "chars": 11347,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/vm/BitInput.java",
    "chars": 2309,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/vm/RarVM.java",
    "chars": 36480,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/vm/VMCmdFlags.java",
    "chars": 4210,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/vm/VMCommands.java",
    "chars": 5124,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/vm/VMFlags.java",
    "chars": 1565,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/vm/VMOpType.java",
    "chars": 1356,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/vm/VMPreparedCommand.java",
    "chars": 1413,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/vm/VMPreparedOperand.java",
    "chars": 1254,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/vm/VMPreparedProgram.java",
    "chars": 2559,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/vm/VMStandardFilterSignature.java",
    "chars": 1337,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unpack/vm/VMStandardFilters.java",
    "chars": 1699,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unsigned/UnsignedByte.java",
    "chars": 1910,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unsigned/UnsignedInteger.java",
    "chars": 738,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unsigned/UnsignedLong.java",
    "chars": 734,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/unsigned/UnsignedShort.java",
    "chars": 735,
    "preview": "/*\r\n * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.\r\n * Original author: Edmund Wagner\r\n * Crea"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/util/VolumeHelper.java",
    "chars": 2762,
    "preview": "package com.github.junrar.util;\r\n\r\n/**\r\n * \r\n * @author alban\r\n */\r\npublic class VolumeHelper {\r\n\tprivate VolumeHelper()"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/vfs2/provider/rar/RARFileObject.java",
    "chars": 3231,
    "preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements.  See the NOT"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/vfs2/provider/rar/RARFileProvider.java",
    "chars": 2862,
    "preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements.  See the NOT"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/vfs2/provider/rar/RARFileSystem.java",
    "chars": 4990,
    "preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements.  See the NOT"
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/vfs2/provider/rar/RandomAccessContentAccess.java",
    "chars": 2070,
    "preview": "/*\n * This file is part of seedbox <github.com/seedbox>.\n *\n * seedbox is free software: you can redistribute it and/or "
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/vfs2/provider/rar/VFSVolume.java",
    "chars": 2161,
    "preview": "/*\n * This file is part of seedbox <github.com/seedbox>.\n *\n * seedbox is free software: you can redistribute it and/or "
  },
  {
    "path": "unrar/src/main/java/com/github/junrar/vfs2/provider/rar/VFSVolumeManager.java",
    "chars": 1794,
    "preview": "/*\n * This file is part of seedbox <github.com/seedbox>.\n *\n * seedbox is free software: you can redistribute it and/or "
  }
]

About this extraction

This page contains the full source code of the edmund-wagner/junrar GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 98 files (344.3 KB), approximately 105.6k tokens, and a symbol index with 803 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!