|
21 | 21 |
|
22 | 22 | package at.favre.lib.bytes; |
23 | 23 |
|
24 | | -import java.io.*; |
| 24 | +import java.io.ByteArrayInputStream; |
| 25 | +import java.io.DataInput; |
| 26 | +import java.io.File; |
| 27 | +import java.io.InputStream; |
| 28 | +import java.io.Serializable; |
25 | 29 | import java.math.BigInteger; |
26 | 30 | import java.nio.ByteBuffer; |
27 | 31 | import java.nio.ByteOrder; |
|
31 | 35 | import java.nio.charset.StandardCharsets; |
32 | 36 | import java.security.SecureRandom; |
33 | 37 | import java.text.Normalizer; |
34 | | -import java.util.*; |
| 38 | +import java.util.Arrays; |
| 39 | +import java.util.BitSet; |
| 40 | +import java.util.Collection; |
| 41 | +import java.util.Iterator; |
| 42 | +import java.util.List; |
| 43 | +import java.util.Objects; |
| 44 | +import java.util.Random; |
| 45 | +import java.util.UUID; |
35 | 46 |
|
36 | 47 | /** |
37 | 48 | * Bytes is wrapper class for an byte-array that allows a lot of convenience operations on it: |
@@ -501,8 +512,7 @@ public static Bytes from(char[] charArray, Charset charset) { |
501 | 512 | * @return new instance |
502 | 513 | */ |
503 | 514 | public static Bytes from(UUID uuid) { |
504 | | - Objects.requireNonNull(uuid); |
505 | | - return wrap(Util.getBytesFromUUID(uuid).array()); |
| 515 | + return wrap(Util.getBytesFromUUID(Objects.requireNonNull(uuid)).array()); |
506 | 516 | } |
507 | 517 |
|
508 | 518 | /** |
@@ -606,10 +616,7 @@ public static Bytes parseBase64(String base64String) { |
606 | 616 | * @return decoded instance |
607 | 617 | */ |
608 | 618 | public static Bytes parse(String encoded, BinaryToTextEncoding.Decoder decoder) { |
609 | | - Objects.requireNonNull(encoded, "encoded data must not be null"); |
610 | | - Objects.requireNonNull(decoder, "passed decoder instance must no be null"); |
611 | | - |
612 | | - return wrap(decoder.decode(encoded)); |
| 619 | + return wrap(Objects.requireNonNull(decoder, "passed decoder instance must no be null").decode(Objects.requireNonNull(encoded, "encoded data must not be null"))); |
613 | 620 | } |
614 | 621 |
|
615 | 622 | /** |
@@ -763,9 +770,7 @@ public Bytes append(CharSequence stringUtf8) { |
763 | 770 | * @return appended instance |
764 | 771 | */ |
765 | 772 | public Bytes append(CharSequence string, Charset charset) { |
766 | | - Objects.requireNonNull(charset); |
767 | | - Objects.requireNonNull(string); |
768 | | - return transform(new BytesTransformer.ConcatTransformer(string.toString().getBytes(charset))); |
| 773 | + return transform(new BytesTransformer.ConcatTransformer(Objects.requireNonNull(string).toString().getBytes(Objects.requireNonNull(charset)))); |
769 | 774 | } |
770 | 775 |
|
771 | 776 | /** |
@@ -1059,8 +1064,7 @@ public boolean validateNotOnlyZeros() { |
1059 | 1064 | * @return true if all validators return true |
1060 | 1065 | */ |
1061 | 1066 | public boolean validate(BytesValidator... bytesValidators) { |
1062 | | - Objects.requireNonNull(bytesValidators); |
1063 | | - return BytesValidators.and(bytesValidators).validate(internalArray()); |
| 1067 | + return BytesValidators.and(Objects.requireNonNull(bytesValidators)).validate(internalArray()); |
1064 | 1068 | } |
1065 | 1069 |
|
1066 | 1070 | /* ATTRIBUTES ************************************************************************************************/ |
|
0 commit comments