Use ParsableBitArray's readString

This commit is contained in:
Pierre-Hugues Husson 2020-02-18 15:04:10 +01:00
parent 274743cddc
commit 90601267e6

View file

@ -116,9 +116,7 @@ public class AitDecoder implements MetadataDecoder {
if(protocolId == TRANSPORT_PROTOCOL_HTTP) { if(protocolId == TRANSPORT_PROTOCOL_HTTP) {
while (sectionData.getBytePosition() < positionOfNextSection2) { while (sectionData.getBytePosition() < positionOfNextSection2) {
int urlBaseLength = sectionData.readBits(8); int urlBaseLength = sectionData.readBits(8);
byte[] urlBaseByteArray = new byte[urlBaseLength]; String urlBase = sectionData.readString(urlBaseLength, Charset.forName("ASCII"));
sectionData.readBytes(urlBaseByteArray, 0, urlBaseLength);
String urlBase = new String(urlBaseByteArray, Charset.forName("ASCII"));
int extensionCount = sectionData.readBits(8); int extensionCount = sectionData.readBits(8);
aitUrlBase = urlBase; aitUrlBase = urlBase;
@ -129,9 +127,7 @@ public class AitDecoder implements MetadataDecoder {
} }
} }
} else if(type == DESCRIPTOR_SIMPLE_APPLICATION_LOCATION) { } else if(type == DESCRIPTOR_SIMPLE_APPLICATION_LOCATION) {
byte[] urlByteArray = new byte[l]; String url = sectionData.readString(l, Charset.forName("ASCII"));
sectionData.readBytes(urlByteArray, 0, l);
String url = new String(urlByteArray, Charset.forName("ASCII"));
aitUrlExtension = url; aitUrlExtension = url;
} }