Fixed: JLayer stripping last byte of MP3 data

This commit is contained in:
Jindra Petřík
2025-06-07 21:57:33 +02:00
parent 7ddb746ad7
commit ac9ceffae2
4 changed files with 13 additions and 7 deletions

View File

@@ -66,6 +66,7 @@ All notable changes to this project will be documented in this file.
- [#2464] SVG export - minimum stroke width of 1 px
- [#2405] Incorrect saving tags after Cloning / Copy-pasting
- [#1646] Scrolling in Error log frame inside log texts
- JLayer stripping last byte of MP3 data
## [23.0.1] - 2025-05-16
### Fixed

Binary file not shown.

View File

@@ -17,9 +17,7 @@ public class MarkingPushbackInputStream extends PushbackInputStream {
public long getPosition() {
return pos;
}
public MarkingPushbackInputStream(InputStream in, int size) {
super(in, size);
is = new PushbackInputStream(in, size);
@@ -47,22 +45,29 @@ public class MarkingPushbackInputStream extends PushbackInputStream {
@Override
public int read() throws IOException {
pos++;
return is.read();
int ret = is.read();
if (ret > -1) {
pos++;
}
return ret;
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
int ret = is.read(b, off, len);
pos += ret;
if (ret > -1) {
pos += ret;
}
return ret;
}
@Override
public int read(byte[] b) throws IOException {
int ret = is.read(b);
pos += ret;
if (ret > -1) {
pos += ret;
}
return ret;
}