Class DfsInserter.PackStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.eclipse.jgit.internal.storage.dfs.DfsInserter.PackStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
- Enclosing class:
- DfsInserter
private class DfsInserter.PackStream extends java.io.OutputStream
-
-
Field Summary
Fields Modifier and Type Field Description private int
blockSize
(package private) java.util.zip.DeflaterOutputStream
compress
(package private) java.util.zip.CRC32
crc32
private byte[]
currBuf
private long
currPos
private int
currPtr
private java.util.zip.Deflater
deflater
(package private) byte[]
hdrBuf
private java.security.MessageDigest
md
private DfsOutputStream
out
-
Constructor Summary
Constructors Constructor Description PackStream(DfsOutputStream out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
beginObject(int objectType, long length)
void
close()
private byte[]
copyOf(byte[] src, int ptr, int cnt)
private int
encodeTypeSize(int type, long rawLength)
private void
flushBlock()
(package private) long
getCount()
private DfsBlock
getOrLoadBlock(long pos)
(package private) byte[]
inflate(DfsReader ctx, long pos, int len)
(package private) int
read(long pos, byte[] dst, int ptr, int cnt)
private int
setInput(long pos, java.util.zip.Inflater inf)
private long
toBlockStart(long pos)
void
write(byte[] data, int off, int len)
void
write(int b)
private void
writeNoHash(byte[] data, int off, int len)
(package private) byte[]
writePackFooter()
-
-
-
Field Detail
-
out
private final DfsOutputStream out
-
md
private final java.security.MessageDigest md
-
hdrBuf
final byte[] hdrBuf
-
deflater
private final java.util.zip.Deflater deflater
-
blockSize
private final int blockSize
-
currPos
private long currPos
-
currPtr
private int currPtr
-
currBuf
private byte[] currBuf
-
crc32
final java.util.zip.CRC32 crc32
-
compress
final java.util.zip.DeflaterOutputStream compress
-
-
Constructor Detail
-
PackStream
PackStream(DfsOutputStream out)
-
-
Method Detail
-
getCount
long getCount()
-
beginObject
void beginObject(int objectType, long length) throws java.io.IOException
- Throws:
java.io.IOException
-
encodeTypeSize
private int encodeTypeSize(int type, long rawLength)
-
write
public void write(int b) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] data, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
writeNoHash
private void writeNoHash(byte[] data, int off, int len) throws java.io.IOException
- Throws:
java.io.IOException
-
flushBlock
private void flushBlock() throws java.io.IOException
- Throws:
java.io.IOException
-
copyOf
private byte[] copyOf(byte[] src, int ptr, int cnt)
-
writePackFooter
byte[] writePackFooter() throws java.io.IOException
- Throws:
java.io.IOException
-
read
int read(long pos, byte[] dst, int ptr, int cnt) throws java.io.IOException
- Throws:
java.io.IOException
-
inflate
byte[] inflate(DfsReader ctx, long pos, int len) throws java.io.IOException, java.util.zip.DataFormatException
- Throws:
java.io.IOException
java.util.zip.DataFormatException
-
setInput
private int setInput(long pos, java.util.zip.Inflater inf) throws java.io.IOException, java.util.zip.DataFormatException
- Throws:
java.io.IOException
java.util.zip.DataFormatException
-
getOrLoadBlock
private DfsBlock getOrLoadBlock(long pos) throws java.io.IOException
- Throws:
java.io.IOException
-
toBlockStart
private long toBlockStart(long pos)
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
-