what-the-bank/sources/org/bouncycastle/crypto/tls/HeartbeatExtension.java

34 lines
939 B
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.crypto.tls;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/* loaded from: classes6.dex */
public class HeartbeatExtension {
protected short mode;
public short getMode() {
return this.mode;
}
public void encode(OutputStream outputStream) throws IOException {
TlsUtils.writeUint8(this.mode, outputStream);
}
public static HeartbeatExtension parse(InputStream inputStream) throws IOException {
short readUint8 = TlsUtils.readUint8(inputStream);
if (HeartbeatMode.isValid(readUint8)) {
return new HeartbeatExtension(readUint8);
}
throw new TlsFatalAlert((short) 47);
}
public HeartbeatExtension(short s) {
if (!HeartbeatMode.isValid(s)) {
throw new IllegalArgumentException("'mode' is not a valid HeartbeatMode value");
}
this.mode = s;
}
}