mirror of
https://github.com/androidx/media.git
synced 2025-05-06 07:00:19 +08:00
Move 3 private methods to the end of the class
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=139204000
This commit is contained in:
parent
348b58021d
commit
21e3361dfe
@ -93,40 +93,6 @@ public final class Id3Decoder implements MetadataDecoder {
|
|||||||
return new Metadata(id3Frames);
|
return new Metadata(id3Frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Move the following three methods nearer to the bottom of the file.
|
|
||||||
private static int indexOfEos(byte[] data, int fromIndex, int encoding) {
|
|
||||||
int terminationPos = indexOfZeroByte(data, fromIndex);
|
|
||||||
|
|
||||||
// For single byte encoding charsets, we're done.
|
|
||||||
if (encoding == ID3_TEXT_ENCODING_ISO_8859_1 || encoding == ID3_TEXT_ENCODING_UTF_8) {
|
|
||||||
return terminationPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise ensure an even index and look for a second zero byte.
|
|
||||||
while (terminationPos < data.length - 1) {
|
|
||||||
if (terminationPos % 2 == 0 && data[terminationPos + 1] == (byte) 0) {
|
|
||||||
return terminationPos;
|
|
||||||
}
|
|
||||||
terminationPos = indexOfZeroByte(data, terminationPos + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int indexOfZeroByte(byte[] data, int fromIndex) {
|
|
||||||
for (int i = fromIndex; i < data.length; i++) {
|
|
||||||
if (data[i] == (byte) 0) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return data.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int delimiterLength(int encodingByte) {
|
|
||||||
return (encodingByte == ID3_TEXT_ENCODING_ISO_8859_1 || encodingByte == ID3_TEXT_ENCODING_UTF_8)
|
|
||||||
? 1 : 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param data A {@link ParsableByteArray} from which the header should be read.
|
* @param data A {@link ParsableByteArray} from which the header should be read.
|
||||||
* @return The parsed header, or null if the ID3 tag is unsupported.
|
* @return The parsed header, or null if the ID3 tag is unsupported.
|
||||||
@ -510,6 +476,39 @@ public final class Id3Decoder implements MetadataDecoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int indexOfEos(byte[] data, int fromIndex, int encoding) {
|
||||||
|
int terminationPos = indexOfZeroByte(data, fromIndex);
|
||||||
|
|
||||||
|
// For single byte encoding charsets, we're done.
|
||||||
|
if (encoding == ID3_TEXT_ENCODING_ISO_8859_1 || encoding == ID3_TEXT_ENCODING_UTF_8) {
|
||||||
|
return terminationPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise ensure an even index and look for a second zero byte.
|
||||||
|
while (terminationPos < data.length - 1) {
|
||||||
|
if (terminationPos % 2 == 0 && data[terminationPos + 1] == (byte) 0) {
|
||||||
|
return terminationPos;
|
||||||
|
}
|
||||||
|
terminationPos = indexOfZeroByte(data, terminationPos + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int indexOfZeroByte(byte[] data, int fromIndex) {
|
||||||
|
for (int i = fromIndex; i < data.length; i++) {
|
||||||
|
if (data[i] == (byte) 0) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int delimiterLength(int encodingByte) {
|
||||||
|
return (encodingByte == ID3_TEXT_ENCODING_ISO_8859_1 || encodingByte == ID3_TEXT_ENCODING_UTF_8)
|
||||||
|
? 1 : 2;
|
||||||
|
}
|
||||||
|
|
||||||
private static final class Id3Header {
|
private static final class Id3Header {
|
||||||
|
|
||||||
private final int majorVersion;
|
private final int majorVersion;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user