You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@baremaps.apache.org by bc...@apache.org on 2024/06/11 15:04:49 UTC
(incubator-baremaps) 01/02: Correctly skip bytes
This is an automated email from the ASF dual-hosted git repository.
bchapuis pushed a commit to branch sonar
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
commit 8e233a1016bc3ead953e577a80da9274d59df162
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Tue Jun 11 17:03:15 2024 +0200
Correctly skip bytes
---
.../src/main/java/org/apache/baremaps/pmtiles/PMTilesReader.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/baremaps-pmtiles/src/main/java/org/apache/baremaps/pmtiles/PMTilesReader.java b/baremaps-pmtiles/src/main/java/org/apache/baremaps/pmtiles/PMTilesReader.java
index 3c7b0d29..55ff4c8d 100644
--- a/baremaps-pmtiles/src/main/java/org/apache/baremaps/pmtiles/PMTilesReader.java
+++ b/baremaps-pmtiles/src/main/java/org/apache/baremaps/pmtiles/PMTilesReader.java
@@ -60,7 +60,10 @@ public class PMTilesReader {
public List<Entry> getDirectory(long offset) {
var header = getHeader();
try (var input = Files.newInputStream(path)) {
- input.skip(offset);
+ long skipped = 0;
+ while (skipped < offset) {
+ skipped += input.skip(offset - skipped);
+ }
try (var decompressed =
new LittleEndianDataInputStream(header.getInternalCompression().decompress(input))) {
return PMTiles.deserializeEntries(decompressed);