APIdia Launch Partner
Top Description Inners Fields Constructors Methods
io.github.spannm.jackcess.impl

public final Class UsageMap

extends Object
Class Inheritance
Imports
io.github.spannm.jackcess.util.ToStringBuilder, java.io.IOException, java.nio.ByteBuffer, java.util.ArrayList, .BitSet, .List

Describes which database pages a particular table uses
Author
Tim McCune

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
UsageMap.GlobalInlineHandler

Modified version of an "inline" usage map used for the global usage map.

private class
UsageMap.GlobalReferenceHandler

Modified version of a "reference" usage map used for the global usage map.

private abstract class
private class
UsageMap.InlineHandler

Usage map whose map is written inline in the same page.

public class
UsageMap.PageCursor

Utility class to traverse over the pages in the UsageMap.

private class
UsageMap.ReferenceHandler

Usage map whose map is written across one or more entire separate pages of page type USAGE_MAP.

Field Summary

Modifier and TypeField and Description
private final DatabaseImpl
database

owning database

private int
endPage

Last page that this usage map applies to

private UsageMap.Handler
handler

the current handler implementation for reading/writing the specific usage map type.

private static final int
INVALID_BIT_INDEX

bit index value for an invalid page number

public static final byte
MAP_TYPE_INLINE

Inline map type

public static final byte
MAP_TYPE_REFERENCE

Reference map type, for maps that are too large to fit inline

private int
modCount

modification count on the usage map, used to keep the cursors in sync

pack-priv static final String
MSG_PREFIX_UNRECOGNIZED_MAP

Error message prefix used when map type is unrecognized.

private final BitSet
pageNumbers

bits representing page numbers used, offset from startPage

private final short
rowStart

Offset of the data page at which the usage map declaration starts

private int
startOffset

Offset of the data page at which the usage map data starts

private int
startPage

First page that this usage map applies to

private final ByteBuffer
tableBuffer

Buffer that contains the usage map table declaration page

private final int
tablePageNum

Page number of the map table declaration

Constructor Summary

AccessConstructor and Description
private
UsageMap(DatabaseImpl
database that contains this usage map
database
,
ByteBuffer
Buffer that contains this map's declaration
tableBuffer
,
int
Page number that this usage map is contained in
pageNum
,
short
Offset at which the declaration starts in the buffer
rowStart
)

Method Summary

Modifier and TypeMethod and Description
public void
addPageNumber(int pageNumber)

Add a page number to this usage map

pack-priv int
bitIndexToPageNumber(int bitIndex, int invalidPageNumber)

pack-priv void
public boolean
containsPageNumber(int pageNumber)

Determines if the given page number is contained in this map.

public UsageMap.PageCursor
public DatabaseImpl
pack-priv int
pack-priv int
public JetFormat
pack-priv int
pack-priv int
getNextBitIndex(int curIndex)

pack-priv int
getNextPageNumber(int curPage)

public PageChannel
public int
pack-priv BitSet
pack-priv int
getPrevBitIndex(int curIndex)

pack-priv int
getPrevPageNumber(int curPage)

pack-priv int
pack-priv short
pack-priv int
pack-priv int
pack-priv ByteBuffer
pack-priv int
private void
initHandler(byte mapType, boolean isGlobal)

pack-priv boolean
isPageWithinRange(int pageNumber)

pack-priv int
pageNumberToBitIndex(int pageNumber)

pack-priv void
processMap(ByteBuffer buffer, int bufferStartPage)

Read in the page numbers in this inline map

private static void
rangeToString(List<String> ranges, int rangeStart, int rangeEnd)

public static UsageMap

Returns:

Either an InlineUsageMap or a ReferenceUsageMap, depending on which type of map is found
read
(DatabaseImpl
database that contains this usage map
database
,
ByteBuffer
buffer which contains the usage map row info
buf
)

Returns either an InlineUsageMap or a ReferenceUsageMap, depending on which type of map is found.

pack-priv static UsageMap

Returns:

Either an InlineUsageMap or a ReferenceUsageMap, depending on which type of map is found
read
(DatabaseImpl
database that contains this usage map
database
,
int
Page number that this usage map is contained in
pageNum
,
int
Number of the row on the page that contains this usage map
rowNum
,
boolean
whether or not we are reading the "global" usage map
isGlobal
)

Returns either an InlineUsageMap or a ReferenceUsageMap, depending on which type of map is found.

public void
removePageNumber(int pageNumber)

Remove a page number from this usage map

private void
removePageNumber(int pageNumber, boolean force)

pack-priv void
setPageRange(int newStartPage, int newEndPage)

pack-priv void
setStartOffset(int startOffset)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

private static int
toValidStartPage(int startPage)

pack-priv void
updateMap(int absolutePageNumber, int bufferRelativePageNumber, ByteBuffer buffer, boolean add, boolean force)

pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait