Skip to content

Commit 7fc628f

Browse files
committed
Small changes to readme
1 parent 9d42b6b commit 7fc628f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Bytes is a utility library that makes it easy to **create**, **parse**, **transform**,
44
**validate** and **convert** byte arrays in Java. It's main class `Bytes` is
55
a collections of bytes and the main API. It supports [endianness](https://en.wikipedia.org/wiki/Endianness)
6-
as well as **immutability** and **mutability**, so the caller may decide to favor
6+
as well as **immutable** and **mutable** access, so the caller may decide to favor
77
performance. This can be seen as combination of the features provided by
88
[`BigInteger`](https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html),
99
[`ByteBuffer`](https://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html) but
@@ -147,7 +147,9 @@ For parsing binary-text-encoded strings, see below.
147147

148148
Transformer transform the internal byte array. It is possible to create
149149
custom transformers if a specific feature is not provided by the default
150-
implementation (see `BytesTransformer`).
150+
implementation (see `BytesTransformer`). Depending on the type (mutable vs
151+
immutable) and transformer it will overwrite the internal byte array
152+
or always create a copy first.
151153

152154
```java
153155
Bytes result = Bytes.wrap(array1).transform(myCustomTransformer);
@@ -387,6 +389,13 @@ b.wipe() //fills with zeros
387389
b.secureWipe() //fills with random data
388390
```
389391

392+
*Note:* a copy will inherit mutability/read-only properties:
393+
394+
```java
395+
Bytes b = Bytes.from(array).mutable().copy();
396+
assertTrue(b.isMutable());
397+
```
398+
390399
#### Readonly Bytes
391400

392401
On the other hand, if you want a export a instance with limited access,

0 commit comments

Comments
 (0)