|
21 | 21 |
|
22 | 22 | package at.favre.lib.bytes; |
23 | 23 |
|
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; |
| 24 | +import java.io.*; |
29 | 25 | import java.math.BigInteger; |
30 | | -import java.nio.ByteBuffer; |
31 | | -import java.nio.ByteOrder; |
32 | | -import java.nio.CharBuffer; |
33 | | -import java.nio.IntBuffer; |
34 | | -import java.nio.ReadOnlyBufferException; |
| 26 | +import java.nio.*; |
35 | 27 | import java.nio.charset.Charset; |
36 | 28 | import java.nio.charset.StandardCharsets; |
37 | 29 | import java.security.SecureRandom; |
38 | 30 | import java.text.Normalizer; |
39 | | -import java.util.Arrays; |
40 | | -import java.util.BitSet; |
41 | | -import java.util.Collection; |
42 | | -import java.util.Iterator; |
43 | | -import java.util.List; |
44 | | -import java.util.Objects; |
45 | | -import java.util.Random; |
46 | | -import java.util.UUID; |
| 31 | +import java.util.*; |
47 | 32 |
|
48 | 33 | /** |
49 | 34 | * Bytes is wrapper class for an byte-array that allows a lot of convenience operations on it: |
@@ -777,6 +762,18 @@ public Bytes append(long long8Bytes) { |
777 | 762 | return append(Bytes.from(long8Bytes)); |
778 | 763 | } |
779 | 764 |
|
| 765 | + /** |
| 766 | + * Creates a new instance with the current array appended to the provided data (ie. append at the end). |
| 767 | + * You may use this to append multiple byte arrays without the need for chaining the {@link #append(byte[])} call |
| 768 | + * and therefore generating intermediate copies of the byte array, making this approach use less memory. |
| 769 | + * |
| 770 | + * @param arrays to append |
| 771 | + * @return appended instance |
| 772 | + */ |
| 773 | + public Bytes append(byte[]... arrays) { |
| 774 | + return append(Bytes.from(arrays)); |
| 775 | + } |
| 776 | + |
780 | 777 | /** |
781 | 778 | * Creates a new instance with the current array appended to the provided data (ie. append at the end) |
782 | 779 | * |
|
0 commit comments