Skip to content

Commit 5162235

Browse files
Artem LabazinArtem Labazin
authored andcommitted
fix reading bytes bugs
1 parent 464038a commit 5162235

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
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.14.1](https://github.com/appulse-projects/utils-java/releases/tag/1.14.1) - 2019-04-14
16+
17+
### Changed
18+
19+
- Fixed reading `Bytes` bugs in `ReadBytesUtils` utility class.
20+
1521
## [1.14.0](https://github.com/appulse-projects/utils-java/releases/tag/1.14.0) - 2019-04-11
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.14.0</version>
27+
<version>1.14.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.14.0</tag>
69+
<tag>1.14.1</tag>
7070
</scm>
7171

7272
<distributionManagement>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public static int read (InputStream inputStream, byte[] buffer, int length) {
163163
@SneakyThrows
164164
public static int read (@NonNull InputStream inputStream, @NonNull Bytes buffer, int length) {
165165
val readed = read(inputStream, buffer.array(), buffer.writerIndex(), length);
166-
buffer.writerIndex(readed);
166+
buffer.writerIndex(buffer.writerIndex() + readed);
167167
return readed;
168168
}
169169

@@ -353,7 +353,7 @@ public static int read (ReadableByteChannel channel, @NonNull Bytes buffer) {
353353
*/
354354
@SneakyThrows
355355
public static int read (@NonNull ReadableByteChannel channel, @NonNull Bytes buffer, int length) {
356-
val readed = read(channel, buffer.array(), length);
356+
val readed = read(channel, buffer.array(), buffer.writerIndex(), length);
357357
buffer.writerIndex(buffer.writerIndex() + readed);
358358
return readed;
359359
}

0 commit comments

Comments
 (0)