]> source.dussan.org Git - jackcess.git/commitdiff
use common row start/end reading methods
authorJames Ahlborn <jtahlborn@yahoo.com>
Thu, 3 Aug 2006 14:19:32 +0000 (14:19 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Thu, 3 Aug 2006 14:19:32 +0000 (14:19 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@84 f203690c-595d-4dc9-a70b-905162fa7fd2

src/java/com/healthmarketscience/jackcess/UsageMap.java

index 642470bae6e20b9a5fd348eab1a96cf7f26b0eb9..5a4adfc8809882a41272ea8fb7de8e688fa03764 100644 (file)
@@ -77,14 +77,9 @@ public abstract class UsageMap {
   {
     ByteBuffer dataBuffer = pageChannel.createPageBuffer();
     pageChannel.readPage(dataBuffer, pageNum);
-    short rowStart = dataBuffer.getShort(format.OFFSET_ROW_START + 2 * rowNum);
-    int rowEnd;
-    if (rowNum == 0) {
-      rowEnd = format.PAGE_SIZE - 1;
-    } else {
-      rowEnd = (dataBuffer.getShort(format.OFFSET_ROW_START + (rowNum - 1) * 2) & 0x0FFF) - 1;
-    }
-    dataBuffer.limit(rowEnd + 1);
+    short rowStart = Table.findRowStart(dataBuffer, rowNum, format);
+    int rowEnd = Table.findRowEnd(dataBuffer, rowNum, format);
+    dataBuffer.limit(rowEnd);    
     byte mapType = dataBuffer.get(rowStart);
     UsageMap rtn;
     if (mapType == MAP_TYPE_INLINE) {