f.java 源代码
package q5;
import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.PsExtractor;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class f extends BufferedOutputStream {
private int f25749q;
private byte[] f25750r;
private byte[] f25751s;
public f(OutputStream outputStream, int i6) {
this(outputStream, i6, 262144);
}
public static void l(OutputStream outputStream, int i6) throws IOException {
outputStream.write(i6);
outputStream.write(i6 >> 8);
outputStream.write(i6 >> 16);
outputStream.write(i6 >> 24);
}
public static void r(OutputStream outputStream, int i6) throws IOException {
if (i6 >= 0) {
while (i6 > 63) {
outputStream.write((i6 & 127) | 128);
i6 >>>= 7;
}
outputStream.write(i6 & 127);
return;
}
while (i6 < -64) {
outputStream.write((i6 & 127) | 128);
i6 >>= 7;
}
outputStream.write(i6 & 127);
}
public static void v(OutputStream outputStream, int i6) throws IOException {
while ((i6 & 4294967295L) > 127) {
outputStream.write((i6 & 127) | 128);
i6 >>>= 7;
}
outputStream.write(i6);
}
public void d() throws IOException {
int i6 = (-getPosition()) & 3;
if (i6 > 0) {
write(this.f25751s, 0, i6);
}
}
public void e(int i6, double d6) throws IOException {
o(i6, Double.doubleToRawLongBits(d6));
}
public void f(int i6, float f6) throws IOException {
n(i6, Float.floatToRawIntBits(f6));
}
public void g(int i6, int i7) throws IOException {
int i8 = 0;
if (i7 >= 0) {
while (i7 > 127) {
this.f25750r[i8] = (byte) i7;
i7 >>= 8;
i8++;
}
} else {
while (i7 < -128) {
this.f25750r[i8] = (byte) i7;
i7 >>= 8;
i8++;
}
}
int i9 = i8 + 1;
this.f25750r[i8] = (byte) i7;
j(i6, i9 - 1);
write(this.f25750r, 0, i9);
}
public int getPosition() {
return this.f25749q;
}
public void h(int i6, long j6) throws IOException {
int i7 = 0;
if (j6 >= 0) {
while (j6 > 127) {
this.f25750r[i7] = (byte) j6;
j6 >>= 8;
i7++;
}
} else {
while (j6 < -128) {
this.f25750r[i7] = (byte) j6;
j6 >>= 8;
i7++;
}
}
int i8 = i7 + 1;
this.f25750r[i7] = (byte) j6;
j(i6, i8 - 1);
write(this.f25750r, 0, i8);
}
public void i(int i6, int i7) throws IOException {
int i8 = 0;
while (true) {
int i9 = i8 + 1;
this.f25750r[i8] = (byte) i7;
i7 >>>= 8;
if (i7 == 0) {
j(i6, i9 - 1);
write(this.f25750r, 0, i9);
return;
}
i8 = i9;
}
}
public void j(int i6, int i7) throws IOException {
write(i6 | (i7 << 5));
}
public void k(int i6) throws IOException {
l(this, i6);
}
public void m(long j6) throws IOException {
k((int) j6);
k((int) (j6 >> 32));
}
protected void n(int i6, int i7) throws IOException {
int i8 = 3;
while (true) {
int i9 = i8 - 1;
this.f25750r[i8] = (byte) (((-16777216) & i7) >>> 24);
i7 <<= 8;
if (i7 == 0) {
int i10 = i9 + 1;
int i11 = 4 - i10;
j(i6, i11 - 1);
write(this.f25750r, i10, i11);
return;
}
i8 = i9;
}
}
protected void o(int i6, long j6) throws IOException {
int i7 = 7;
while (true) {
int i8 = i7 - 1;
this.f25750r[i7] = (byte) (((-72057594037927936L) & j6) >>> 56);
j6 <<= 8;
if (j6 == 0) {
int i9 = i8 + 1;
int i10 = 8 - i9;
j(i6, i10 - 1);
write(this.f25750r, i9, i10);
return;
}
i7 = i8;
}
}
public void p(int i6) throws IOException {
if (i6 >= -32768 && i6 <= 32767) {
write(i6);
write(i6 >> 8);
return;
}
throw new v5.g("Short value out of range: %d", Integer.valueOf(i6));
}
public void q(int i6) throws IOException {
r(this, i6);
}
public void s(String str) throws IOException {
int length = str.length();
if (this.f25750r.length <= str.length() * 3) {
this.f25750r = new byte[str.length() * 3];
}
byte[] bArr = this.f25750r;
int i6 = 0;
for (int i7 = 0; i7 < length; i7++) {
char charAt = str.charAt(i7);
if (charAt != 0 && charAt < 128) {
bArr[i6] = (byte) charAt;
i6++;
} else if (charAt < 2048) {
int i8 = i6 + 1;
bArr[i6] = (byte) (((charAt >> 6) & 31) | PsExtractor.AUDIO_STREAM);
i6 = i8 + 1;
bArr[i8] = (byte) ((charAt & '?') | 128);
} else {
int i9 = i6 + 1;
bArr[i6] = (byte) (((charAt >> '\f') & 15) | 224);
int i10 = i9 + 1;
bArr[i9] = (byte) (((charAt >> 6) & 63) | 128);
bArr[i10] = (byte) ((charAt & '?') | 128);
i6 = i10 + 1;
}
}
write(bArr, 0, i6);
}
public void t(int i6) throws IOException {
if (i6 >= 0 && i6 <= 255) {
write(i6);
return;
}
throw new v5.g("Unsigned byte value out of range: %d", Integer.valueOf(i6));
}
public void u(int i6) throws IOException {
v(this, i6);
}
public void w(int i6) throws IOException {
if (i6 >= 0 && i6 <= 65535) {
write(i6);
write(i6 >> 8);
return;
}
throw new v5.g("Unsigned short value out of range: %d", Integer.valueOf(i6));
}
@Override
public void write(int i6) throws IOException {
this.f25749q++;
super.write(i6);
}
public f(OutputStream outputStream, int i6, int i7) {
super(outputStream, i7);
this.f25750r = new byte[8];
this.f25751s = new byte[3];
this.f25749q = i6;
}
@Override
public void write(byte[] bArr) throws IOException {
write(bArr, 0, bArr.length);
}
@Override
public void write(byte[] bArr, int i6, int i7) throws IOException {
this.f25749q += i7;
super.write(bArr, i6, i7);
}
}