Top Description Fields Constructors Methods
org.eclipse.jgit.internal.storage.file

pack-priv abstract Class ByteWindow

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.internal.storage.file.ByteArrayWindow, org.eclipse.jgit.internal.storage.file.ByteBufferWindow
Imports
java.io.IOException, java.util.zip.DataFormatException, .Inflater, org.eclipse.jgit.internal.storage.pack.PackOutputStream

A 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.

Field Summary

Modifier and TypeField and Description
protected final long
protected final Pack
protected final long

Constructor Summary

AccessConstructor and Description
protected
ByteWindow(Pack p, long
where the byte window starts in the pack file
s
,
int
size of the byte window
n
)

Constructor for ByteWindow.

Method Summary

Modifier and TypeMethod and Description
pack-priv final boolean
contains(Pack neededPack, long neededPos)

pack-priv final int

Returns:

number of bytes actually copied; this may be less than cnt if cnt exceeded the number of bytes available.
copy
(long
offset within the file to start copying from.
pos
,
byte[]
destination buffer to copy into.
dstbuf
,
int
offset within dstbuf to start copying into.
dstoff
,
int
number of bytes to copy. This value may exceed the number of bytes remaining in the window starting at offset pos.
cnt
)

Copy bytes from the window to a caller supplied buffer.

protected abstract int

Returns:

number of bytes actually copied; this may be less than cnt if cnt exceeded the number of bytes available.
copy
(int
offset within the window to start copying from.
pos
,
byte[]
destination buffer to copy into.
dstbuf
,
int
offset within dstbuf to start copying into.
dstoff
,
int
number of bytes to copy. This value may exceed the number of bytes remaining in the window starting at offset pos.
cnt
)

Copy bytes from the window to a caller supplied buffer.

pack-priv final int
setInput(long pos, Inflater inf)

protected abstract int

Returns:

size of the byte window
setInput
(int
position
pos
,
Inflater inf)

Set the input

pack-priv final int
size()

pack-priv abstract void
write(PackOutputStream out, long pos, int cnt)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endback to summary
protected final long end
packback to summary
protected final Pack pack
startback to summary
protected final long start

Constructor Detail

ByteWindowback to summary
protected ByteWindow(Pack p, long s, int n)

Constructor for ByteWindow.

Parameters
p:Pack

a org.eclipse.jgit.internal.storage.file.Pack.

s:long

where the byte window starts in the pack file

n:int

size of the byte window

Method Detail

containsback to summary
pack-priv final boolean contains(Pack neededPack, long neededPos)
copyback to summary
pack-priv final int copy(long pos, byte[] dstbuf, int dstoff, int cnt)

Copy bytes from the window to a caller supplied buffer.

Parameters
pos:long

offset within the file to start copying from.

dstbuf:byte[]

destination buffer to copy into.

dstoff:int

offset within dstbuf to start copying into.

cnt:int

number of bytes to copy. This value may exceed the number of bytes remaining in the window starting at offset pos.

Returns:int

number of bytes actually copied; this may be less than cnt if cnt exceeded the number of bytes available.

copyback to summary
protected abstract int copy(int pos, byte[] dstbuf, int dstoff, int cnt)

Copy bytes from the window to a caller supplied buffer.

Parameters
pos:int

offset within the window to start copying from.

dstbuf:byte[]

destination buffer to copy into.

dstoff:int

offset within dstbuf to start copying into.

cnt:int

number of bytes to copy. This value may exceed the number of bytes remaining in the window starting at offset pos.

Returns:int

number of bytes actually copied; this may be less than cnt if cnt exceeded the number of bytes available.

setInputback to summary
pack-priv final int setInput(long pos, Inflater inf) throws DataFormatException
setInputback to summary
protected abstract int setInput(int pos, Inflater inf) throws DataFormatException

Set the input

Parameters
pos:int

position

inf:Inflater

an java.util.zip.Inflater object.

Returns:int

size of the byte window

Exceptions
DataFormatException:
if any.
sizeback to summary
pack-priv final int size()
writeback to summary
pack-priv abstract void write(PackOutputStream out, long pos, int cnt) throws IOException