Skip to content

Commit

Permalink
Fix #139 reading string datasets from chunked v4 files no longer fails
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmudd committed Dec 19, 2019
1 parent 6db7c00 commit e4a694c
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -16,6 +16,7 @@


import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
Expand All @@ -25,6 +26,8 @@
import java.util.Map; import java.util.Map;
import java.util.stream.IntStream; import java.util.stream.IntStream;


import static java.nio.ByteOrder.LITTLE_ENDIAN;

public final class VariableLengthDatasetReader { public final class VariableLengthDatasetReader {


/** No instances */ /** No instances */
Expand Down Expand Up @@ -96,6 +99,9 @@ private static List<GlobalHeapId> getGlobalHeapIds(ByteBuffer bb, int length, Hd


final int skipBytes = length - hdfFc.getSizeOfOffsets() - 4; // id=4 final int skipBytes = length - hdfFc.getSizeOfOffsets() - 4; // id=4


// Assume all global heap buffers are little endian
bb.order(LITTLE_ENDIAN);

while (bb.remaining() >= length) { while (bb.remaining() >= length) {
// Move past the skipped bytes. TODO figure out what this is for // Move past the skipped bytes. TODO figure out what this is for
bb.position(bb.position() + skipBytes); bb.position(bb.position() + skipBytes);
Expand Down

0 comments on commit e4a694c

Please sign in to comment.