You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2026/06/11 18:56:52 UTC
(sis) 02/02: Move part of the `org.apache.sis.storage.geotiff.inflater` package to `org.apache.sis.io.stream.inflater` for sharing with GeoHEIF.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 4a5efac0c6675b4d4f17e9d7c2384f38fa485676
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Jun 9 10:15:59 2026 +0200
Move part of the `org.apache.sis.storage.geotiff.inflater` package
to `org.apache.sis.io.stream.inflater` for sharing with GeoHEIF.
---
.../org/apache/sis/storage/geotiff/DataSubset.java | 4 +--
.../sis/storage/geotiff/inflater/CCITTRLE.java | 3 +-
.../geotiff/inflater/HorizontalPredictor.java | 15 +++++-----
.../sis/storage/geotiff/inflater/Inflater.java | 15 ++++++----
.../apache/sis/storage/geotiff/inflater/LZW.java | 10 ++++++-
.../sis/storage/geotiff/inflater/PackBits.java | 3 +-
.../storage/geotiff/inflater/PredictorChannel.java | 8 ++++--
.../org.apache.sis.storage/main/module-info.java | 4 +++
.../io/stream/inflater/ComputedByteChannel.java} | 16 ++++++-----
.../apache/sis/io/stream}/inflater/Deflate.java | 9 ++----
.../sis/io/stream/inflater/InflaterChannel.java} | 29 ++++++++++----------
.../sis/io/stream/inflater/package-info.java | 32 ++++++++++++++++++++++
12 files changed, 99 insertions(+), 49 deletions(-)
diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/DataSubset.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/DataSubset.java
index 346440cfa0..f3591d0f4f 100644
--- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/DataSubset.java
+++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/DataSubset.java
@@ -372,8 +372,8 @@ class DataSubset extends TiledGridCoverage {
* Tile not yet loaded. Add to a queue of tiles to load later.
* Notify the input channel about the ranges of bytes to read.
* This notification is redundant with the same notification
- * done in `CompressionChannel.setInputRegion(…)`, but doing
- * all notifications in advance gives a chance to group ranges.
+ * done in `InflaterChannel.setInputRegion(…)`, but doing all
+ * notifications in advance gives a chance to group ranges.
*/
final Tile missing = new Tile(iterator, tileOffsets, includedBanks, numTiles);
missings[numMissings++] = missing;
diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/CCITTRLE.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/CCITTRLE.java
index 7e748820cd..5877156e7f 100644
--- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/CCITTRLE.java
+++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/CCITTRLE.java
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.sis.storage.event.StoreListeners;
import org.apache.sis.io.stream.ChannelDataInput;
+import org.apache.sis.io.stream.inflater.InflaterChannel;
/**
@@ -44,7 +45,7 @@ import org.apache.sis.io.stream.ChannelDataInput;
*
* @author Martin Desruisseaux (Geomatys)
*/
-final class CCITTRLE extends CompressionChannel {
+final class CCITTRLE extends InflaterChannel {
/**
* Modified Huffman tree for length of runs of white and black colors. This array is generated by
* the {@code CCITTRLETest} class, which will also verifies that those values are still corrects.
diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/HorizontalPredictor.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/HorizontalPredictor.java
index cf7b381313..14bb7c2c69 100644
--- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/HorizontalPredictor.java
+++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/HorizontalPredictor.java
@@ -19,6 +19,7 @@ package org.apache.sis.storage.geotiff.inflater;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.sis.image.DataType;
+import org.apache.sis.io.stream.inflater.InflaterChannel;
import org.apache.sis.pending.jdk.JDK13;
@@ -82,7 +83,7 @@ abstract class HorizontalPredictor extends PredictorChannel {
* @param width number of pixels in the source image.
* @param sampleSize number of bytes in a sample value.
*/
- HorizontalPredictor(final CompressionChannel input, final int samplesPerPixel, final int width, final int sampleSize) {
+ HorizontalPredictor(final InflaterChannel input, final int samplesPerPixel, final int width, final int sampleSize) {
super(input);
sampleSizeM1 = sampleSize - Byte.BYTES;
truncationMask = ~sampleSizeM1;
@@ -100,7 +101,7 @@ abstract class HorizontalPredictor extends PredictorChannel {
* @param width number of pixels in the source image.
* @return the predictor, or {@code null} if the given type is unsupported.
*/
- static HorizontalPredictor create(final CompressionChannel input, final DataType dataType,
+ static HorizontalPredictor create(final InflaterChannel input, final DataType dataType,
final int pixelStride, final int width)
{
switch (dataType.toPrimitive()) {
@@ -247,7 +248,7 @@ abstract class HorizontalPredictor extends PredictorChannel {
/**
* Creates a new predictor.
*/
- Bytes(final CompressionChannel input, final int samplesPerPixel, final int width) {
+ Bytes(final InflaterChannel input, final int samplesPerPixel, final int width) {
super(input, samplesPerPixel, width, Byte.BYTES);
savedValues = new byte[samplesPerPixel];
}
@@ -304,7 +305,7 @@ abstract class HorizontalPredictor extends PredictorChannel {
/**
* Creates a new predictor.
*/
- Shorts(final CompressionChannel input, final int samplesPerPixel, final int width) {
+ Shorts(final InflaterChannel input, final int samplesPerPixel, final int width) {
super(input, samplesPerPixel, width, Short.BYTES);
savedValues = new short[samplesPerPixel];
}
@@ -368,7 +369,7 @@ abstract class HorizontalPredictor extends PredictorChannel {
/**
* Creates a new predictor.
*/
- Integers(final CompressionChannel input, final int samplesPerPixel, final int width) {
+ Integers(final InflaterChannel input, final int samplesPerPixel, final int width) {
super(input, samplesPerPixel, width, Integer.BYTES);
savedValues = new int[samplesPerPixel];
}
@@ -432,7 +433,7 @@ abstract class HorizontalPredictor extends PredictorChannel {
/**
* Creates a new predictor.
*/
- Floats(final CompressionChannel input, final int samplesPerPixel, final int width) {
+ Floats(final InflaterChannel input, final int samplesPerPixel, final int width) {
super(input, samplesPerPixel, width, Float.BYTES);
savedValues = new float[samplesPerPixel];
}
@@ -496,7 +497,7 @@ abstract class HorizontalPredictor extends PredictorChannel {
/**
* Creates a new predictor.
*/
- Doubles(final CompressionChannel input, final int samplesPerPixel, final int width) {
+ Doubles(final InflaterChannel input, final int samplesPerPixel, final int width) {
super(input, samplesPerPixel, width, Double.BYTES);
savedValues = new double[samplesPerPixel];
}
diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/Inflater.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/Inflater.java
index a79573bc04..659b447b13 100644
--- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/Inflater.java
+++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/Inflater.java
@@ -28,6 +28,9 @@ import org.apache.sis.storage.geotiff.base.CompressionMethod;
import org.apache.sis.storage.geotiff.base.Predictor;
import org.apache.sis.storage.geotiff.base.Resources;
import org.apache.sis.io.stream.ChannelDataInput;
+import org.apache.sis.io.stream.inflater.ComputedByteChannel;
+import org.apache.sis.io.stream.inflater.InflaterChannel;
+import org.apache.sis.io.stream.inflater.Deflate;
import org.apache.sis.storage.event.StoreListeners;
import static org.apache.sis.pending.jdk.JDK18.ceilDiv;
@@ -39,7 +42,7 @@ import static org.apache.sis.pending.jdk.JDK18.ceilDiv;
*
* <p>If a decompression algorithm can handle all above-cited aspects directly,
* it can extend this class directly. If it would be too complicated, an easier
- * approach is to extend {@link CompressionChannel} instead and wrap that inflater
+ * approach is to extend {@link InflaterChannel} instead and wrap that inflater
* in a {@link CopyFromBytes} subclass for managing the sub-region, subsampling
* and band subset.</p>
*
@@ -197,7 +200,7 @@ public abstract class Inflater implements Closeable {
throws IOException, UnsupportedEncodingException
{
ArgumentChecks.ensureNonNull("input", input);
- final CompressionChannel inflater;
+ final InflaterChannel inflater;
switch (compression) {
case LZW: inflater = new LZW (input, listeners); break;
case DEFLATE: inflater = new Deflate (input, listeners); break;
@@ -213,7 +216,7 @@ public abstract class Inflater implements Closeable {
throw unsupportedEncoding(listeners, Resources.Keys.UnsupportedCompressionMethod_1, compression);
}
}
- final PixelChannel channel;
+ final ComputedByteChannel channel;
switch (predictor) {
case NONE: {
channel = inflater;
@@ -261,8 +264,8 @@ public abstract class Inflater implements Closeable {
* will perform a seek operation. As a consequence the buffer content become invalid and
* must be emptied.
*/
- if (input.channel instanceof PixelChannel) {
- ((PixelChannel) input.channel).setInputRegion(start, byteCount);
+ if (input.channel instanceof ComputedByteChannel) {
+ ((ComputedByteChannel) input.channel).setInputRegion(start, byteCount);
input.refresh(start);
}
}
@@ -311,7 +314,7 @@ public abstract class Inflater implements Closeable {
*/
@Override
public final void close() throws IOException {
- if (input.channel instanceof PixelChannel) {
+ if (input.channel instanceof ComputedByteChannel) {
input.channel.close();
}
}
diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/LZW.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/LZW.java
index e0141af165..532fd83821 100644
--- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/LZW.java
+++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/LZW.java
@@ -22,6 +22,7 @@ import java.io.EOFException;
import java.nio.ByteBuffer;
import org.apache.sis.storage.geotiff.base.Resources;
import org.apache.sis.io.stream.ChannelDataInput;
+import org.apache.sis.io.stream.inflater.InflaterChannel;
import org.apache.sis.storage.event.StoreListeners;
@@ -36,7 +37,7 @@ import org.apache.sis.storage.event.StoreListeners;
* @author Martin Desruisseaux (Geomatys)
* @author Rémi Maréchal (Geomatys)
*/
-final class LZW extends CompressionChannel {
+final class LZW extends InflaterChannel {
/**
* A 12 bits code meaning that we have exhausted the 4093 available codes
* and must reset the table to the initial set of 9 bits code.
@@ -471,6 +472,13 @@ final class LZW extends CompressionChannel {
return target.position() - start;
}
+ /**
+ * Returns the resources for error messages.
+ */
+ private Resources resources() {
+ return Resources.forLocale(listeners.getLocale());
+ }
+
/**
* The exception to throw if the decompression process encounters data that it cannot process.
*/
diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/PackBits.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/PackBits.java
index cb3ce2ab5a..d29b7b6b4f 100644
--- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/PackBits.java
+++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/PackBits.java
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.sis.storage.event.StoreListeners;
import org.apache.sis.io.stream.ChannelDataInput;
+import org.apache.sis.io.stream.inflater.InflaterChannel;
/**
@@ -28,7 +29,7 @@ import org.apache.sis.io.stream.ChannelDataInput;
*
* @author Martin Desruisseaux (Geomatys)
*/
-final class PackBits extends CompressionChannel {
+final class PackBits extends InflaterChannel {
/**
* Number of bytes to copy literally from the input.
* Only one of {@code literalCount} and {@link #duplicatedCount} can be non-zero.
diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/PredictorChannel.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/PredictorChannel.java
index 223382a214..e80589f39e 100644
--- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/PredictorChannel.java
+++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/PredictorChannel.java
@@ -20,6 +20,8 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.pending.jdk.JDK13;
+import org.apache.sis.io.stream.inflater.ComputedByteChannel;
+import org.apache.sis.io.stream.inflater.InflaterChannel;
/**
@@ -29,11 +31,11 @@ import org.apache.sis.pending.jdk.JDK13;
*
* @author Martin Desruisseaux (Geomatys)
*/
-abstract class PredictorChannel extends PixelChannel {
+abstract class PredictorChannel extends ComputedByteChannel {
/**
* The channel from which to read data.
*/
- private final CompressionChannel input;
+ private final InflaterChannel input;
/**
* If {@link #read(ByteBuffer)} could not process some trailing bytes,
@@ -52,7 +54,7 @@ abstract class PredictorChannel extends PixelChannel {
*
* @param input the channel that decompress data.
*/
- protected PredictorChannel(final CompressionChannel input) {
+ protected PredictorChannel(final InflaterChannel input) {
this.input = input;
deferred = ArraysExt.EMPTY_BYTE;
}
diff --git a/endorsed/src/org.apache.sis.storage/main/module-info.java b/endorsed/src/org.apache.sis.storage/main/module-info.java
index 4a43ba85e5..0155e9b867 100644
--- a/endorsed/src/org.apache.sis.storage/main/module-info.java
+++ b/endorsed/src/org.apache.sis.storage/main/module-info.java
@@ -92,6 +92,10 @@ module org.apache.sis.storage {
org.apache.sis.console,
org.apache.sis.gui; // In the "optional" sub-project.
+ exports org.apache.sis.io.stream.inflater to
+ org.apache.sis.storage.geotiff,
+ org.apache.sis.storage.geoheif; // In the "incubator" sub-project.
+
exports org.apache.sis.storage.xml to
org.apache.sis.storage.xml,
org.apache.sis.gui; // In the "optional" sub-project.
diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/PixelChannel.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/ComputedByteChannel.java
similarity index 78%
rename from endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/PixelChannel.java
rename to endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/ComputedByteChannel.java
index 971a653279..cddd8c803b 100644
--- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/PixelChannel.java
+++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/ComputedByteChannel.java
@@ -14,18 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.storage.geotiff.inflater;
+package org.apache.sis.io.stream.inflater;
import java.io.IOException;
import java.nio.channels.ReadableByteChannel;
/**
- * A channel of pixel values after all steps have been completed.
- * The steps may be:
+ * Base class of channels providing values that are computed on-the-fly.
+ * The computation typically uses another channel as its source.
+ * Examples:
*
* <ul>
- * <li>Decompression alone, in which case this class is a subtype of {@link CompressionChannel}.</li>
+ * <li>Decompression alone, in which case this class is a subtype of {@link InflaterChannel}.</li>
* <li>Decompression followed by some mathematical operation applied on the data after decompression.
* In that case this class is a subtype of {@link PredictorChannel}.</li>
* </ul>
@@ -34,15 +35,16 @@ import java.nio.channels.ReadableByteChannel;
*
* @author Martin Desruisseaux (Geomatys)
*/
-abstract class PixelChannel implements ReadableByteChannel {
+public abstract class ComputedByteChannel implements ReadableByteChannel {
/**
* Creates a new channel.
*/
- protected PixelChannel() {
+ protected ComputedByteChannel() {
}
/**
- * Prepares this channel for reading a new tile or a new band of a planar image.
+ * Prepares this channel for reading a new block of data.
+ * A block may be, for example, a tile or a band of a tile.
*
* @param start stream position where to start reading.
* @param byteCount number of bytes to read from the input.
diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/Deflate.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/Deflate.java
similarity index 90%
rename from endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/Deflate.java
rename to endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/Deflate.java
index d8fa212a5e..49d7bd0eef 100644
--- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/Deflate.java
+++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/Deflate.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.storage.geotiff.inflater;
+package org.apache.sis.io.stream.inflater;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -31,7 +31,7 @@ import org.apache.sis.io.stream.ChannelDataInput;
* @author Rémi Marechal (Geomatys)
* @author Martin Desruisseaux (Geomatys)
*/
-final class Deflate extends CompressionChannel {
+public final class Deflate extends InflaterChannel {
/**
* Access to the ZLIB compression library.
* Must be released by call to {@link Inflater#end()} after decompression is completed.
@@ -45,9 +45,6 @@ final class Deflate extends CompressionChannel {
*
* @param input the source of data to decompress.
* @param listeners object where to report warnings.
- * @param start stream position where to start reading.
- * @param byteCount number of bytes to read from the input.
- * @throws IOException if the stream cannot be seek to the given start position.
*/
public Deflate(final ChannelDataInput input, final StoreListeners listeners) {
super(input, listeners);
@@ -55,7 +52,7 @@ final class Deflate extends CompressionChannel {
}
/**
- * Prepares this inflater for reading a new tile or a new band of a tile.
+ * Prepares this channel for reading a new block of data.
*
* @param start stream position where to start reading.
* @param byteCount number of bytes to read from the input.
diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/CompressionChannel.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/InflaterChannel.java
similarity index 85%
rename from endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/CompressionChannel.java
rename to endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/InflaterChannel.java
index e24163771d..16d81de18f 100644
--- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/inflater/CompressionChannel.java
+++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/InflaterChannel.java
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.storage.geotiff.inflater;
+package org.apache.sis.io.stream.inflater;
import java.util.Arrays;
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.nio.BufferOverflowException;
import org.apache.sis.math.MathFunctions;
import org.apache.sis.storage.StorageConnector;
-import org.apache.sis.storage.geotiff.base.Resources;
import org.apache.sis.io.stream.ChannelDataInput;
import org.apache.sis.storage.event.StoreListeners;
import org.apache.sis.pending.jdk.JDK18;
@@ -35,7 +35,7 @@ import org.apache.sis.pending.jdk.JDK18;
*
* @author Martin Desruisseaux (Geomatys)
*/
-abstract class CompressionChannel extends PixelChannel {
+public abstract class InflaterChannel extends ComputedByteChannel {
/**
* Desired size of the buffer where to temporarily copy decompressed data.
* The actual buffer size may become larger (but not smaller)
@@ -66,13 +66,13 @@ abstract class CompressionChannel extends PixelChannel {
* @param input the source of data to decompress.
* @param listeners object where to report warnings.
*/
- protected CompressionChannel(final ChannelDataInput input, final StoreListeners listeners) {
+ protected InflaterChannel(final ChannelDataInput input, final StoreListeners listeners) {
this.input = input;
this.listeners = listeners;
}
/**
- * Prepares this inflater for reading a new tile or a new band of a tile.
+ * Prepares this channel for reading a new block of data.
*
* @param start stream position where to start reading.
* @param byteCount number of bytes to read from the input.
@@ -108,7 +108,7 @@ abstract class CompressionChannel extends PixelChannel {
* @throws IOException if an error occurred while filling the buffer with initial data.
* @return the data input for uncompressed data.
*/
- final ChannelDataInput createDataInput(final PixelChannel channel, final int scanlineStride, final boolean directBuffer)
+ public final ChannelDataInput createDataInput(final ComputedByteChannel channel, final int scanlineStride, final boolean directBuffer)
throws IOException
{
final int capacity;
@@ -127,9 +127,15 @@ abstract class CompressionChannel extends PixelChannel {
/**
* Copies the given byte <var>n</var> times in the given buffer.
+ * This is a convenience method for an operation frequently found in different compression algorithms.
+ *
+ * @param target where to append the bytes.
+ * @param value the byte to repeat.
+ * @param count number of time to repeat the given value.
+ * @throws BufferOverflowException if {@code count} is greater than the remaining space in the buffer.
*/
- static void repeat(final ByteBuffer target, final byte b, int n) {
- while (--n >= 0) target.put(b);
+ protected static void repeat(final ByteBuffer target, final byte value, int count) {
+ while (--count >= 0) target.put(value);
}
/**
@@ -149,11 +155,4 @@ abstract class CompressionChannel extends PixelChannel {
public void close() {
// Do NOT close `input`.
}
-
- /**
- * Returns the resources for error messages.
- */
- final Resources resources() {
- return Resources.forLocale(listeners.getLocale());
- }
}
diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/package-info.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/package-info.java
new file mode 100644
index 0000000000..e1d7c0a718
--- /dev/null
+++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/inflater/package-info.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Utility classes for the implementation of data stores that need to decompress block of data.
+ *
+ * <STRONG>Do not use!</STRONG>
+ *
+ * This package is for internal use by <abbr>SIS</abbr> only.
+ * Classes in this package may change in incompatible ways in any future version without notice.
+ *
+ * <p>More implementations of the base classes in this package are provided in other modules such as GeoTIFF.
+ * Some of these implementations may move to this package in the future if there is a need to share compression
+ * algorithms.</p>
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ */
+package org.apache.sis.io.stream.inflater;