summaryrefslogtreecommitdiff
path: root/src/com/github/junrar/rarfile
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/github/junrar/rarfile')
-rw-r--r--src/com/github/junrar/rarfile/AVHeader.java66
-rw-r--r--src/com/github/junrar/rarfile/BaseBlock.java179
-rw-r--r--src/com/github/junrar/rarfile/BlockHeader.java70
-rw-r--r--src/com/github/junrar/rarfile/CommentHeader.java70
-rw-r--r--src/com/github/junrar/rarfile/EAHeader.java90
-rw-r--r--src/com/github/junrar/rarfile/EndArcHeader.java63
-rw-r--r--src/com/github/junrar/rarfile/FileHeader.java421
-rw-r--r--src/com/github/junrar/rarfile/FileNameDecoder.java76
-rw-r--r--src/com/github/junrar/rarfile/HostSystem.java72
-rw-r--r--src/com/github/junrar/rarfile/MacInfoHeader.java81
-rw-r--r--src/com/github/junrar/rarfile/MainHeader.java141
-rw-r--r--src/com/github/junrar/rarfile/MarkHeader.java84
-rw-r--r--src/com/github/junrar/rarfile/NewSubHeaderType.java89
-rw-r--r--src/com/github/junrar/rarfile/ProtectHeader.java71
-rw-r--r--src/com/github/junrar/rarfile/SignHeader.java60
-rw-r--r--src/com/github/junrar/rarfile/SubBlockHeader.java70
-rw-r--r--src/com/github/junrar/rarfile/SubBlockHeaderType.java77
-rw-r--r--src/com/github/junrar/rarfile/UnixOwnersHeader.java93
-rw-r--r--src/com/github/junrar/rarfile/UnrarHeadertype.java164
19 files changed, 0 insertions, 2037 deletions
diff --git a/src/com/github/junrar/rarfile/AVHeader.java b/src/com/github/junrar/rarfile/AVHeader.java
deleted file mode 100644
index 66e9dbb..0000000
--- a/src/com/github/junrar/rarfile/AVHeader.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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:
- * "&": "&" or "&"
- * "<": "&#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;
- }
-}
diff --git a/src/com/github/junrar/rarfile/BaseBlock.java b/src/com/github/junrar/rarfile/BaseBlock.java
deleted file mode 100644
index 68c2d94..0000000
--- a/src/com/github/junrar/rarfile/BaseBlock.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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 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());
- }
-}
diff --git a/src/com/github/junrar/rarfile/BlockHeader.java b/src/com/github/junrar/rarfile/BlockHeader.java
deleted file mode 100644
index 78fe955..0000000
--- a/src/com/github/junrar/rarfile/BlockHeader.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 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);
- }
-}
diff --git a/src/com/github/junrar/rarfile/CommentHeader.java b/src/com/github/junrar/rarfile/CommentHeader.java
deleted file mode 100644
index 2664330..0000000
--- a/src/com/github/junrar/rarfile/CommentHeader.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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;
- }
-}
diff --git a/src/com/github/junrar/rarfile/EAHeader.java b/src/com/github/junrar/rarfile/EAHeader.java
deleted file mode 100644
index 762e644..0000000
--- a/src/com/github/junrar/rarfile/EAHeader.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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 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);
- }
-}
-
diff --git a/src/com/github/junrar/rarfile/EndArcHeader.java b/src/com/github/junrar/rarfile/EndArcHeader.java
deleted file mode 100644
index 5a9be5e..0000000
--- a/src/com/github/junrar/rarfile/EndArcHeader.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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;
- }
-}
diff --git a/src/com/github/junrar/rarfile/FileHeader.java b/src/com/github/junrar/rarfile/FileHeader.java
deleted file mode 100644
index 84dce5e..0000000
--- a/src/com/github/junrar/rarfile/FileHeader.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * 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 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;
- }
-}
diff --git a/src/com/github/junrar/rarfile/FileNameDecoder.java b/src/com/github/junrar/rarfile/FileNameDecoder.java
deleted file mode 100644
index aee1179..0000000
--- a/src/com/github/junrar/rarfile/FileNameDecoder.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * 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();
- }
-}
diff --git a/src/com/github/junrar/rarfile/HostSystem.java b/src/com/github/junrar/rarfile/HostSystem.java
deleted file mode 100644
index 7970fef..0000000
--- a/src/com/github/junrar/rarfile/HostSystem.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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;
-}
diff --git a/src/com/github/junrar/rarfile/MacInfoHeader.java b/src/com/github/junrar/rarfile/MacInfoHeader.java
deleted file mode 100644
index e94521d..0000000
--- a/src/com/github/junrar/rarfile/MacInfoHeader.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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 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);
- }
-
-}
diff --git a/src/com/github/junrar/rarfile/MainHeader.java b/src/com/github/junrar/rarfile/MainHeader.java
deleted file mode 100644
index 8c3e89f..0000000
--- a/src/com/github/junrar/rarfile/MainHeader.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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 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;
- }
-}
diff --git a/src/com/github/junrar/rarfile/MarkHeader.java b/src/com/github/junrar/rarfile/MarkHeader.java
deleted file mode 100644
index 1673306..0000000
--- a/src/com/github/junrar/rarfile/MarkHeader.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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 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());
- }
-}
diff --git a/src/com/github/junrar/rarfile/NewSubHeaderType.java b/src/com/github/junrar/rarfile/NewSubHeaderType.java
deleted file mode 100644
index e0096f7..0000000
--- a/src/com/github/junrar/rarfile/NewSubHeaderType.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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);
- }
-}
diff --git a/src/com/github/junrar/rarfile/ProtectHeader.java b/src/com/github/junrar/rarfile/ProtectHeader.java
deleted file mode 100644
index 348b25b..0000000
--- a/src/com/github/junrar/rarfile/ProtectHeader.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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;
- }
-}
diff --git a/src/com/github/junrar/rarfile/SignHeader.java b/src/com/github/junrar/rarfile/SignHeader.java
deleted file mode 100644
index e78d4a3..0000000
--- a/src/com/github/junrar/rarfile/SignHeader.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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;
- }
-}
diff --git a/src/com/github/junrar/rarfile/SubBlockHeader.java b/src/com/github/junrar/rarfile/SubBlockHeader.java
deleted file mode 100644
index d0e0eed..0000000
--- a/src/com/github/junrar/rarfile/SubBlockHeader.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 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);
- }
-}
diff --git a/src/com/github/junrar/rarfile/SubBlockHeaderType.java b/src/com/github/junrar/rarfile/SubBlockHeaderType.java
deleted file mode 100644
index 000f24d..0000000
--- a/src/com/github/junrar/rarfile/SubBlockHeaderType.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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;
- }
-}
diff --git a/src/com/github/junrar/rarfile/UnixOwnersHeader.java b/src/com/github/junrar/rarfile/UnixOwnersHeader.java
deleted file mode 100644
index 192ba7a..0000000
--- a/src/com/github/junrar/rarfile/UnixOwnersHeader.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package com.github.junrar.rarfile;
-
-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);
- }
-}
diff --git a/src/com/github/junrar/rarfile/UnrarHeadertype.java b/src/com/github/junrar/rarfile/UnrarHeadertype.java
deleted file mode 100644
index 9214759..0000000
--- a/src/com/github/junrar/rarfile/UnrarHeadertype.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * 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;
- }
-
-
-
-
-}