Package aQute.lib.putjar
Class DirectoryInputStream
- java.lang.Object
-
- java.io.InputStream
-
- aQute.lib.putjar.DirectoryInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class DirectoryInputStream extends java.io.InputStream
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static intBUFFER_SIZE(package private) java.io.InputStreamcurrent(package private) static intDATA(package private) java.io.ByteArrayOutputStreamdirectory(package private) static intDIRECTORY(package private) java.io.Fileelement(package private) intentries(package private) static java.io.InputStreameof(package private) static intEOF(package private) FileIteratorfi(package private) static intHEADER(package private) java.io.Fileroot(package private) static intSTART(package private) intstate(package private) longwhere
-
Constructor Summary
Constructors Constructor Description DirectoryInputStream(java.io.File dir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.zip.CRC32getCRC(java.io.File file)(package private) java.io.InputStreamgetDirectory()end of central dir signature 4 bytes (0x06054b50) number of this disk 2 bytes number of the disk with the start of the central directory 2 bytes total number of entries in the central directory on this disk 2 bytes total number of entries in the central directory 2 bytes size of the central directory 4 bytes offset of start of central directory with respect to the starting disk number 4 bytes .ZIP file comment length 2 bytes .ZIP file comment (variable size)private java.io.InputStreamgetHeader(java.io.File root, java.io.File file)Local file header:private java.lang.StringgetPath(java.io.File root, java.io.File file)(package private) voidnext()private voidnextHeader()intread()private voidwriteInt(java.io.OutputStream out, int v)private voidwriteShort(java.io.OutputStream out, int v)
-
-
-
Field Detail
-
BUFFER_SIZE
static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
root
final java.io.File root
-
fi
final FileIterator fi
-
element
java.io.File element
-
entries
int entries
-
state
int state
-
where
long where
-
START
static final int START
- See Also:
- Constant Field Values
-
HEADER
static final int HEADER
- See Also:
- Constant Field Values
-
DATA
static final int DATA
- See Also:
- Constant Field Values
-
DIRECTORY
static final int DIRECTORY
- See Also:
- Constant Field Values
-
EOF
static final int EOF
- See Also:
- Constant Field Values
-
eof
static final java.io.InputStream eof
-
directory
java.io.ByteArrayOutputStream directory
-
current
java.io.InputStream current
-
-
Method Detail
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
next
void next() throws java.io.IOException
- Throws:
java.io.IOException
-
nextHeader
private void nextHeader() throws java.io.IOException- Throws:
java.io.IOException
-
getDirectory
java.io.InputStream getDirectory() throws java.io.IOExceptionend of central dir signature 4 bytes (0x06054b50) number of this disk 2 bytes number of the disk with the start of the central directory 2 bytes total number of entries in the central directory on this disk 2 bytes total number of entries in the central directory 2 bytes size of the central directory 4 bytes offset of start of central directory with respect to the starting disk number 4 bytes .ZIP file comment length 2 bytes .ZIP file comment (variable size)
- Throws:
java.io.IOException
-
writeShort
private void writeShort(java.io.OutputStream out, int v) throws java.io.IOException- Throws:
java.io.IOException
-
writeInt
private void writeInt(java.io.OutputStream out, int v) throws java.io.IOException- Throws:
java.io.IOException
-
getHeader
private java.io.InputStream getHeader(java.io.File root, java.io.File file) throws java.io.IOExceptionLocal file header:local file header signature 4 bytes (0x04034b50) version needed to extract 2 bytes general purpose bit flag 2 bytes compression method 2 bytes last mod file time 2 bytes last mod file date 2 bytes crc-32 4 bytes compressed size 4 bytes uncompressed size 4 bytes file name length 2 bytes extra field length 2 bytes file name (variable size) extra field (variable size) central file header signature 4 bytes (0x02014b50) version made by 2 bytes version needed to extract 2 bytes general purpose bit flag 2 bytes compression method 2 bytes last mod file time 2 bytes last mod file date 2 bytes crc-32 4 bytes compressed size 4 bytes uncompressed size 4 bytes file name length 2 bytes extra field length 2 bytes file comment length 2 bytes disk number start 2 bytes internal file attributes 2 bytes external file attributes 4 bytes relative offset of local header 4 bytes file name (variable size) extra field (variable size) file comment (variable size)
- Throws:
java.io.IOException
-
getPath
private java.lang.String getPath(java.io.File root, java.io.File file)
-
getCRC
private java.util.zip.CRC32 getCRC(java.io.File file) throws java.io.IOException- Throws:
java.io.IOException
-
-