From 8a9ab54e2eb9ef16e6129c7a90123230c09d279e Mon Sep 17 00:00:00 2001 From: Evgenii Kliuchnikov Date: Fri, 7 Nov 2025 06:59:16 -0800 Subject: [PATCH] fix JavaDoc warnings PiperOrigin-RevId: 829420925 --- java/org/brotli/dec/BrotliError.java | 41 +++++++++++++++++++--- java/org/brotli/dec/BrotliInputStream.java | 4 +++ java/org/brotli/dec/DecodeTest.java | 1 - java/org/brotli/dec/Decoder.java | 5 +++ java/org/brotli/dec/Dictionary.java | 5 +++ 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/java/org/brotli/dec/BrotliError.java b/java/org/brotli/dec/BrotliError.java index 223bbac..2b1fd10 100644 --- a/java/org/brotli/dec/BrotliError.java +++ b/java/org/brotli/dec/BrotliError.java @@ -6,42 +6,73 @@ package org.brotli.dec; -/** - * Possible errors from decoder. - */ -public class BrotliError { +/** Possible errors from decoder. */ +public final class BrotliError { + /** Success; anything greater is also success. */ public static final int BROTLI_OK = 0; + /** Success; decoder has finished decompressing the input. */ public static final int BROTLI_OK_DONE = BROTLI_OK + 1; + /** Success; decoder has more output to produce. */ public static final int BROTLI_OK_NEED_MORE_OUTPUT = BROTLI_OK + 2; - // It is important that actual error codes are LESS than -1! + /** Error code threshold; actual error codes are LESS than -1! */ public static final int BROTLI_ERROR = -1; + /** Stream error: corrupted code length table. */ public static final int BROTLI_ERROR_CORRUPTED_CODE_LENGTH_TABLE = BROTLI_ERROR - 1; + /** Stream error: corrupted context map. */ public static final int BROTLI_ERROR_CORRUPTED_CONTEXT_MAP = BROTLI_ERROR - 2; + /** Stream error: corrupted Huffman code histogram. */ public static final int BROTLI_ERROR_CORRUPTED_HUFFMAN_CODE_HISTOGRAM = BROTLI_ERROR - 3; + /** Stream error: corrupted padding bits. */ public static final int BROTLI_ERROR_CORRUPTED_PADDING_BITS = BROTLI_ERROR - 4; + /** Stream error: corrupted reserved bit. */ public static final int BROTLI_ERROR_CORRUPTED_RESERVED_BIT = BROTLI_ERROR - 5; + /** Stream error: duplicate simple Huffman symbol. */ public static final int BROTLI_ERROR_DUPLICATE_SIMPLE_HUFFMAN_SYMBOL = BROTLI_ERROR - 6; + /** Stream error: exuberant nibble. */ public static final int BROTLI_ERROR_EXUBERANT_NIBBLE = BROTLI_ERROR - 7; + /** Stream error: invalid backward reference. */ public static final int BROTLI_ERROR_INVALID_BACKWARD_REFERENCE = BROTLI_ERROR - 8; + /** Stream error: invalid metablock length. */ public static final int BROTLI_ERROR_INVALID_METABLOCK_LENGTH = BROTLI_ERROR - 9; + /** Stream error: invalid window bits. */ public static final int BROTLI_ERROR_INVALID_WINDOW_BITS = BROTLI_ERROR - 10; + /** Stream error: negative distance. */ public static final int BROTLI_ERROR_NEGATIVE_DISTANCE = BROTLI_ERROR - 11; + /** Stream error: read after end of input buffer. */ public static final int BROTLI_ERROR_READ_AFTER_END = BROTLI_ERROR - 12; + /** IO error: read failed. */ public static final int BROTLI_ERROR_READ_FAILED = BROTLI_ERROR - 13; + /** IO error: symbol out of range. */ public static final int BROTLI_ERROR_SYMBOL_OUT_OF_RANGE = BROTLI_ERROR - 14; + /** Stream error: truncated input. */ public static final int BROTLI_ERROR_TRUNCATED_INPUT = BROTLI_ERROR - 15; + /** Stream error: unused bytes after end of stream. */ public static final int BROTLI_ERROR_UNUSED_BYTES_AFTER_END = BROTLI_ERROR - 16; + /** Stream error: unused Huffman space. */ public static final int BROTLI_ERROR_UNUSED_HUFFMAN_SPACE = BROTLI_ERROR - 17; + /** Exception code threshold. */ public static final int BROTLI_PANIC = -21; + /** Exception: stream is already closed. */ public static final int BROTLI_PANIC_ALREADY_CLOSED = BROTLI_PANIC - 1; + /** Exception: max distance is too small. */ public static final int BROTLI_PANIC_MAX_DISTANCE_TOO_SMALL = BROTLI_PANIC - 2; + /** Exception: state is not fresh. */ public static final int BROTLI_PANIC_STATE_NOT_FRESH = BROTLI_PANIC - 3; + /** Exception: state is not initialized. */ public static final int BROTLI_PANIC_STATE_NOT_INITIALIZED = BROTLI_PANIC - 4; + /** Exception: state is not uninitialized. */ public static final int BROTLI_PANIC_STATE_NOT_UNINITIALIZED = BROTLI_PANIC - 5; + /** Exception: too many dictionary chunks. */ public static final int BROTLI_PANIC_TOO_MANY_DICTIONARY_CHUNKS = BROTLI_PANIC - 6; + /** Exception: unexpected state. */ public static final int BROTLI_PANIC_UNEXPECTED_STATE = BROTLI_PANIC - 7; + /** Exception: unreachable code. */ public static final int BROTLI_PANIC_UNREACHABLE = BROTLI_PANIC - 8; + /** Exception: unaligned copy bytes. */ public static final int BROTLI_PANIC_UNALIGNED_COPY_BYTES = BROTLI_PANIC - 9; + + /** Non-instantiable. */ + private BrotliError() {} } diff --git a/java/org/brotli/dec/BrotliInputStream.java b/java/org/brotli/dec/BrotliInputStream.java index 24935db..83ecc56 100644 --- a/java/org/brotli/dec/BrotliInputStream.java +++ b/java/org/brotli/dec/BrotliInputStream.java @@ -16,6 +16,7 @@ import java.io.InputStream; */ public class BrotliInputStream extends InputStream { + /** Default size of internal buffer (used for faster byte-by-byte reading). */ public static final int DEFAULT_INTERNAL_BUFFER_SIZE = 256; /** @@ -93,14 +94,17 @@ public class BrotliInputStream extends InputStream { } } + /** Attach "RAW" dictionary (chunk) to decoder. */ public void attachDictionaryChunk(byte[] data) { Decode.attachDictionaryChunk(state, data); } + /** Request decoder to produce output as soon as it is available. */ public void enableEagerOutput() { Decode.enableEagerOutput(state); } + /** Enable "large window" stream feature. */ public void enableLargeWindow() { Decode.enableLargeWindow(state); } diff --git a/java/org/brotli/dec/DecodeTest.java b/java/org/brotli/dec/DecodeTest.java index 1028aef..db724e3 100644 --- a/java/org/brotli/dec/DecodeTest.java +++ b/java/org/brotli/dec/DecodeTest.java @@ -144,7 +144,6 @@ public class DecodeTest { public void testUtils() { new Context(); new Decode(); - new Dictionary(); new Huffman(); } } diff --git a/java/org/brotli/dec/Decoder.java b/java/org/brotli/dec/Decoder.java index e33f5a9..4adac65 100644 --- a/java/org/brotli/dec/Decoder.java +++ b/java/org/brotli/dec/Decoder.java @@ -6,6 +6,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +/** Toy decoder CLI; mostly used for simple benchmarking. */ public class Decoder { private static long decodeBytes(InputStream input, OutputStream output, byte[] buffer) throws IOException { @@ -53,6 +54,7 @@ public class Decoder { System.out.println(mbDecoded / timeDelta + " MiB/s"); } + /** CLI entry point. */ public static void main(String... args) throws IOException { if (args.length != 2 && args.length != 3) { System.out.println("Usage: decoder [repeat]"); @@ -69,4 +71,7 @@ public class Decoder { decompress(args[0], args[1], buffer); } } + + /** Non-instantiable. */ + private Decoder() {} } diff --git a/java/org/brotli/dec/Dictionary.java b/java/org/brotli/dec/Dictionary.java index 8dfbc45..8be850d 100644 --- a/java/org/brotli/dec/Dictionary.java +++ b/java/org/brotli/dec/Dictionary.java @@ -41,6 +41,7 @@ public final class Dictionary { private static final int DICTIONARY_DEBUG = Utils.isDebugMode(); + /** Initialize static dictionary. */ public static void setData(ByteBuffer newData, int[] newSizeBits) { if (DICTIONARY_DEBUG != 0) { if ((Utils.isDirect(newData) == 0) || (Utils.isReadOnly(newData) == 0)) { @@ -90,6 +91,7 @@ public final class Dictionary { Dictionary.data = newData; } + /** Access static dictionary. */ public static ByteBuffer getData() { if (data.capacity() != 0) { return data; @@ -100,4 +102,7 @@ public final class Dictionary { /* Might have been set when {@link DictionaryData} was loaded.*/ return data; } + + /** Non-instantiable. */ + private Dictionary() {} }