Class ByteWindow
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.file.ByteWindow
-
- Direct Known Subclasses:
ByteArrayWindow,ByteBufferWindow
abstract class ByteWindow extends java.lang.ObjectA window of data currently stored within a cache.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.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedByteWindow(Pack p, long s, int n)Constructor for ByteWindow.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) booleancontains(Pack neededPack, long neededPos)protected abstract intcopy(int pos, byte[] dstbuf, int dstoff, int cnt)Copy bytes from the window to a caller supplied buffer.(package private) intcopy(long pos, byte[] dstbuf, int dstoff, int cnt)Copy bytes from the window to a caller supplied buffer.protected abstract intsetInput(int pos, java.util.zip.Inflater inf)Set the input(package private) intsetInput(long pos, java.util.zip.Inflater inf)(package private) intsize()(package private) abstract voidwrite(PackOutputStream out, long pos, int cnt)
-
-
-
Field Detail
-
pack
protected final Pack pack
-
start
protected final long start
-
end
protected final long end
-
-
Method Detail
-
size
final int size()
-
contains
final boolean contains(Pack neededPack, long neededPos)
-
copy
final int copy(long pos, byte[] dstbuf, int dstoff, int cnt)Copy bytes from the window to a caller supplied buffer.- Parameters:
pos- offset within the file to start copying from.dstbuf- destination buffer to copy into.dstoff- offset withindstbufto start copying into.cnt- number of bytes to copy. This value may exceed the number of bytes remaining in the window starting at offsetpos.- Returns:
- number of bytes actually copied; this may be less than
cntifcntexceeded the number of bytes available.
-
copy
protected abstract int copy(int pos, byte[] dstbuf, int dstoff, int cnt)Copy bytes from the window to a caller supplied buffer.- Parameters:
pos- offset within the window to start copying from.dstbuf- destination buffer to copy into.dstoff- offset withindstbufto start copying into.cnt- number of bytes to copy. This value may exceed the number of bytes remaining in the window starting at offsetpos.- Returns:
- number of bytes actually copied; this may be less than
cntifcntexceeded the number of bytes available.
-
write
abstract void write(PackOutputStream out, long pos, int cnt) throws java.io.IOException
- Throws:
java.io.IOException
-
setInput
final int setInput(long pos, java.util.zip.Inflater inf) throws java.util.zip.DataFormatException- Throws:
java.util.zip.DataFormatException
-
setInput
protected abstract int setInput(int pos, java.util.zip.Inflater inf) throws java.util.zip.DataFormatExceptionSet the input- Parameters:
pos- positioninf- anInflaterobject.- Returns:
- size of the byte window
- Throws:
java.util.zip.DataFormatException- if any.
-
-