This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 9c41f4cd10c57f8f2e1df8f6b844938edf4d19ff Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Mon Nov 18 09:01:41 2024 -0500 Sort members --- .../compress/compressors/gzip/ExtraField.java | 92 +++++++++++----------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/ExtraField.java b/src/main/java/org/apache/commons/compress/compressors/gzip/ExtraField.java index 2de74e9fb..5e8e80b20 100644 --- a/src/main/java/org/apache/commons/compress/compressors/gzip/ExtraField.java +++ b/src/main/java/org/apache/commons/compress/compressors/gzip/ExtraField.java @@ -184,6 +184,43 @@ public class ExtraField implements Iterable<SubField> { return this; } + /** + * Removes all subfields from this instance. + */ + public void clear() { + subFields.clear(); + totalSize = 0; + } + + /** + * Finds the first subfield that matched the id if found, null otherwise + * + * @return the 1st SubField that matched or null. + */ + public SubField findFirstSubField(String subfieldId) { + return subFields.stream().filter(f -> f.getId().equals(subfieldId)).findFirst().orElse(null); + } + + /** + * Calculate the size in bytes of the encoded extra field. This does not include + * its own 16 bits size when embeded in the gzip header. For N sub fields, the + * total is all subfields payloads bytes + 4N. + * + * @return the bytes count of this extra payload when encoded. + */ + public int getEncodedSize() { + return totalSize; + } + + /** + * Return the count of subfields currently in in this extra field. + * + * @return the count of subfields contained in this instance. + */ + public int getSize() { + return subFields.size(); + } + /** * Gets the subfield at the given index. * @@ -195,6 +232,15 @@ public class ExtraField implements Iterable<SubField> { return subFields.get(index); } + /** + * Test is this extra field has no subfields. + * + * @return true if there are no subfields, false otherwise. + */ + public boolean isEmpty() { + return subFields.isEmpty(); + } + /** * Returns an immutable iterator over the SubField elements in this extra field * in the order they were added. @@ -223,50 +269,4 @@ public class ExtraField implements Iterable<SubField> { return ba; } - /** - * Test is this extra field has no subfields. - * - * @return true if there are no subfields, false otherwise. - */ - public boolean isEmpty() { - return subFields.isEmpty(); - } - - /** - * Removes all subfields from this instance. - */ - public void clear() { - subFields.clear(); - totalSize = 0; - } - - /** - * Calculate the size in bytes of the encoded extra field. This does not include - * its own 16 bits size when embeded in the gzip header. For N sub fields, the - * total is all subfields payloads bytes + 4N. - * - * @return the bytes count of this extra payload when encoded. - */ - public int getEncodedSize() { - return totalSize; - } - - /** - * Return the count of subfields currently in in this extra field. - * - * @return the count of subfields contained in this instance. - */ - public int getSize() { - return subFields.size(); - } - - /** - * Finds the first subfield that matched the id if found, null otherwise - * - * @return the 1st SubField that matched or null. - */ - public SubField findFirstSubField(String subfieldId) { - return subFields.stream().filter(f -> f.getId().equals(subfieldId)).findFirst().orElse(null); - } - }