abstract class ByteWindow
extends java.lang.Object
All bytes in the window can be assumed to be "immediately available", that is they are very likely already in memory, unless the operating system's memory is very low and has paged part of this process out to disk. Therefore copying bytes from a window is very inexpensive.
Modifier and Type | Field and Description |
---|---|
protected long |
end |
protected PackFile |
pack |
protected long |
start |
Modifier | Constructor and Description |
---|---|
protected |
ByteWindow(PackFile p,
long s,
int n)
Constructor for ByteWindow.
|
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
contains(PackFile neededFile,
long neededPos) |
protected abstract int |
copy(int pos,
byte[] dstbuf,
int dstoff,
int cnt)
Copy bytes from the window to a caller supplied buffer.
|
(package private) int |
copy(long pos,
byte[] dstbuf,
int dstoff,
int cnt)
Copy bytes from the window to a caller supplied buffer.
|
protected abstract int |
setInput(int pos,
java.util.zip.Inflater inf)
Set the input
|
(package private) int |
setInput(long pos,
java.util.zip.Inflater inf) |
(package private) int |
size() |
(package private) abstract void |
write(PackOutputStream out,
long pos,
int cnt) |
protected final PackFile pack
protected final long start
protected final long end
final int size()
final boolean contains(PackFile neededFile, long neededPos)
final int copy(long pos, byte[] dstbuf, int dstoff, int cnt)
pos
- offset within the file to start copying from.dstbuf
- destination buffer to copy into.dstoff
- offset within dstbuf
to start copying into.cnt
- number of bytes to copy. This value may exceed the number of
bytes remaining in the window starting at offset
pos
.cnt
if cnt
exceeded the number of
bytes available.protected abstract int copy(int pos, byte[] dstbuf, int dstoff, int cnt)
pos
- offset within the window to start copying from.dstbuf
- destination buffer to copy into.dstoff
- offset within dstbuf
to start copying into.cnt
- number of bytes to copy. This value may exceed the number of
bytes remaining in the window starting at offset
pos
.cnt
if cnt
exceeded the number of
bytes available.abstract void write(PackOutputStream out, long pos, int cnt) throws java.io.IOException
java.io.IOException
final int setInput(long pos, java.util.zip.Inflater inf) throws java.util.zip.DataFormatException
java.util.zip.DataFormatException
protected abstract int setInput(int pos, java.util.zip.Inflater inf) throws java.util.zip.DataFormatException
pos
- positioninf
- an Inflater
object.java.util.zip.DataFormatException
- if any.