Skip to content

Commit 833558b

Browse files
committed
Sort members
1 parent f890da3 commit 833558b

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

src/main/java/org/apache/commons/codec/binary/Base16.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,16 @@ public Builder setLowerCase(final boolean lowerCase) {
159159
/** Mask used to extract 4 bits, used when decoding character. */
160160
private static final int MASK_4_BITS = 0x0f;
161161

162+
/**
163+
* Constructs a new builder.
164+
*
165+
* @return a new builder.
166+
* @since 1.20.0
167+
*/
168+
public static Builder builder() {
169+
return new Builder();
170+
}
171+
162172
private static byte[] toDecodeTable(final byte[] encodeTable) {
163173
if (Arrays.equals(encodeTable, UPPER_CASE_ENCODE_TABLE)) {
164174
return UPPER_CASE_DECODE_TABLE;
@@ -185,16 +195,6 @@ private static byte[] toDecodeTable(final byte[] encodeTable) {
185195
return decodeTable;
186196
}
187197

188-
/**
189-
* Constructs a new builder.
190-
*
191-
* @return a new builder.
192-
* @since 1.20.0
193-
*/
194-
public static Builder builder() {
195-
return new Builder();
196-
}
197-
198198
/**
199199
* Constructs a Base16 codec used for decoding and encoding.
200200
*/

src/test/java/org/apache/commons/codec/binary/Base16Test.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ private void testBase16InBuffer(final int startPasSize, final int endPadSize) {
9191
assertEquals("48656C6C6F20576F726C64", encodedContent, "encoding hello world");
9292
}
9393

94+
@Test
95+
void testBuilderSetLowerCaseDecodesOwnOutput() {
96+
final Base16 base16 = Base16.builder().setLowerCase(true).get();
97+
final byte[] data = { (byte) 0xab };
98+
final byte[] encoded = base16.encode(data);
99+
assertEquals("ab", new String(encoded, StandardCharsets.US_ASCII));
100+
assertArrayEquals(data, base16.decode(encoded));
101+
}
102+
94103
@Test
95104
void testByteToStringVariations() {
96105
final Base16 base16 = new Base16();
@@ -173,15 +182,6 @@ void testCustomEncodeTableRejectsInvalidLength() {
173182
() -> Base16.builder().setEncodeTable("0123456789ABCDE".getBytes(StandardCharsets.US_ASCII)));
174183
}
175184

176-
@Test
177-
void testBuilderSetLowerCaseDecodesOwnOutput() {
178-
final Base16 base16 = Base16.builder().setLowerCase(true).get();
179-
final byte[] data = { (byte) 0xab };
180-
final byte[] encoded = base16.encode(data);
181-
assertEquals("ab", new String(encoded, StandardCharsets.US_ASCII));
182-
assertArrayEquals(data, base16.decode(encoded));
183-
}
184-
185185
@Test
186186
void testDecodeSingleBytes() {
187187
final String encoded = "556E74696C206E6578742074696D6521";

0 commit comments

Comments
 (0)