Skip to content

Commit 8730ff7

Browse files
Artem LabazinArtem Labazin
authored andcommitted
Add toString to Bytes class
1 parent 02ec8b7 commit 8730ff7

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
- Add more tests.
1313
- Add `JavaDoc`.
1414

15+
## [1.15.1](https://github.com/appulse-projects/utils-java/releases/tag/1.15.1) - 2019-04-23
16+
17+
### Added
18+
19+
- `BytesAbstract` has `toString` default implementation.
20+
1521
## [1.15.0](https://github.com/appulse-projects/utils-java/releases/tag/1.15.0) - 2019-04-17
1622

1723
### Added

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ limitations under the License.
2424

2525
<groupId>io.appulse</groupId>
2626
<artifactId>utils-java</artifactId>
27-
<version>1.15.0</version>
27+
<version>1.15.1</version>
2828
<packaging>jar</packaging>
2929

3030
<properties>
@@ -66,7 +66,7 @@ limitations under the License.
6666
<url>https://github.com/appulse-projects/utils-java</url>
6767
<connection>scm:git:https://github.com/appulse-projects/utils-java.git</connection>
6868
<developerConnection>scm:git:https://github.com/appulse-projects/utils-java.git</developerConnection>
69-
<tag>1.15.0</tag>
69+
<tag>1.15.1</tag>
7070
</scm>
7171

7272
<distributionManagement>

src/main/java/io/appulse/utils/BytesAbstract.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,17 @@ public byte[] arrayCopy () {
479479
return Arrays.copyOfRange(array(), 0, writerIndex());
480480
}
481481

482+
@Override
483+
public String toString () {
484+
return new StringBuilder()
485+
.append(getClass().getSimpleName()).append('{')
486+
.append("capacity=").append(capacity()).append(',')
487+
.append("readerIndex=").append(readerIndex()).append(',')
488+
.append("writerIndex=").append(writerIndex())
489+
.append('}')
490+
.toString();
491+
}
492+
482493
protected void checkWriteBounds (int index, int length) {
483494
if (index < readerIndex() || index + length > capacity()) {
484495
val msg = String.format("Writer index error. index(%d) < readerIndex(%d) || index(%d)+length(%d) > capacity(%d)",

0 commit comments

Comments
 (0)