mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-15 18:37:17 +01:00
38 lines
1 KiB
Java
38 lines
1 KiB
Java
package com.fasterxml.jackson.databind.util;
|
|
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.nio.ByteBuffer;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes7.dex */
|
|
public class ByteBufferBackedInputStream extends InputStream {
|
|
protected final ByteBuffer _b;
|
|
|
|
public ByteBufferBackedInputStream(ByteBuffer byteBuffer) {
|
|
this._b = byteBuffer;
|
|
}
|
|
|
|
@Override // java.io.InputStream
|
|
public int available() {
|
|
return this._b.remaining();
|
|
}
|
|
|
|
@Override // java.io.InputStream
|
|
public int read(byte[] bArr, int i, int i2) throws IOException {
|
|
if (!this._b.hasRemaining()) {
|
|
return -1;
|
|
}
|
|
int min = Math.min(i2, this._b.remaining());
|
|
this._b.get(bArr, i, min);
|
|
return min;
|
|
}
|
|
|
|
@Override // java.io.InputStream
|
|
public int read() throws IOException {
|
|
if (this._b.hasRemaining()) {
|
|
return this._b.get() & 255;
|
|
}
|
|
return -1;
|
|
}
|
|
}
|