Commit 101b7122 by Lev

Cleanup

parent 5e3b817b
......@@ -234,7 +234,7 @@ public final class ParsableByteArray {
/** Peeks at the next char. */
public char peekLittleEndianChar() {
return (char) ((data[position] & 0xFF) | (data[position + 1] & 0xFF) << 8 );
return (char) ((data[position] & 0xFF) | (data[position + 1] & 0xFF) << 8);
}
/** Reads the next byte as an unsigned value. */
......@@ -554,12 +554,12 @@ public final class ParsableByteArray {
*/
@Nullable
public String readUtfLine(Charset charset) {
if(!charset.equals(Charsets.UTF_8)
if (!charset.equals(Charsets.UTF_8)
&& !charset.equals(Charsets.UTF_16BE)
&& !charset.equals(Charsets.UTF_16LE)) {
throw new IllegalArgumentException("Only UTF-8, UTF-16LE, UTF-16BE encoding supported.");
}
if(charset.equals(Charsets.UTF_8)) {
if (charset.equals(Charsets.UTF_8)) {
return readLine();
}
......
......@@ -149,13 +149,11 @@ public final class SubripDecoder extends SimpleSubtitleDecoder {
* @return determined encoding
*/
private Charset detectUtfCharset(ParsableByteArray data) {
if(data.limit() < 2) {
if (data.limit() < 2) {
return Charsets.UTF_8;
}
char twoBytes = data.peekChar();
switch (twoBytes) {
switch (data.peekChar()) {
case ParsableByteArray.BOM_UTF16_BE:
return Charsets.UTF_16BE;
case ParsableByteArray.BOM_UTF16_LE:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment