Class FilePageArray
java.lang.Object
org.cojen.tupl.io.PageArray
org.cojen.tupl.io.FilePageArray
- All Implemented Interfaces:
Closeable
,AutoCloseable
,CauseCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
int
Returns a positive page size if not using direct I/O, else negate to get the page size to allocate for direct I/O.void
expandPageCount
(long count) Attempt to expand the total count of pages.factory
(int pageSize, File file, EnumSet<OpenOption> options) boolean
isClosed()
boolean
isEmpty()
boolean
long
Returns the total count of pages in the array, or Long.MAX_VALUE if not applicable.void
readPage
(long index, long dstAddr, int offset, int length) void
sync
(boolean metadata) Durably flushes all writes to the underlying device.void
truncatePageCount
(long count) Attempt to truncate the total count of pages.void
writePage
(long index, long srcAddr, int offset) Writes a page, which is lazily flushed.Methods inherited from class org.cojen.tupl.io.PageArray
close, copyPage, copyPageFromAddress, directPageAddress, dirtyPage, evictPage, isDirectIO, isFullyMapped, pageCountLimit, pageSize, readPage, syncPage, writePage
-
Constructor Details
-
FilePageArray
-
-
Method Details
-
factory
-
directPageSize
public int directPageSize()Description copied from class:PageArray
Returns a positive page size if not using direct I/O, else negate to get the page size to allocate for direct I/O.- Overrides:
directPageSize
in classPageArray
-
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnly
in classPageArray
-
isEmpty
- Specified by:
isEmpty
in classPageArray
- Throws:
IOException
-
pageCount
Description copied from class:PageArray
Returns the total count of pages in the array, or Long.MAX_VALUE if not applicable.- Specified by:
pageCount
in classPageArray
- Throws:
IOException
-
truncatePageCount
Description copied from class:PageArray
Attempt to truncate the total count of pages. Array implementation might not support truncating the page count, in which case this method does nothing.- Specified by:
truncatePageCount
in classPageArray
- Throws:
IOException
-
expandPageCount
Description copied from class:PageArray
Attempt to expand the total count of pages. Array implementation might not support expanding the page count, in which case this method does nothing.- Specified by:
expandPageCount
in classPageArray
- Throws:
IOException
-
readPage
- Specified by:
readPage
in classPageArray
- Parameters:
index
- zero-based page index to readdstAddr
- receives read dataoffset
- offset into data buffer- Throws:
IOException
- if index is greater than or equal to page count
-
writePage
Description copied from class:PageArray
Writes a page, which is lazily flushed. The array grows automatically if the index is greater than or equal to the current page count. If array supports caching, page must be immediately copied into it.- Specified by:
writePage
in classPageArray
- Parameters:
index
- zero-based page index to writesrcAddr
- data to writeoffset
- offset into data buffer- Throws:
IOException
-
sync
Description copied from class:PageArray
Durably flushes all writes to the underlying device.- Specified by:
sync
in classPageArray
- Parameters:
metadata
- pass true to flush all file metadata- Throws:
IOException
-
close
- Specified by:
close
in interfaceCauseCloseable
- Specified by:
close
in classPageArray
- Parameters:
cause
- null if close is not caused by a failure- Throws:
IOException
-
isClosed
-