java.lang.Object
net.i2p.data.DataStructureImpl
net.i2p.data.i2cp.AbuseSeverity
- All Implemented Interfaces:
Serializable, DataStructure
Provides a severity level (larger numbers are more severe) in association with a client reporting abusive behavior to the router or the router reporting it to the client.
- See Also:
Field Summary
FieldsConstructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionbooleanCompares this abuse severity with another object for equality.intSeverity level of the abuse.inthashCode()Hash code based on the severity level.voidreadBytes(InputStream in) Reads the severity level from a stream.voidsetSeverity(int id) New severity level of the abuse.toString()Returns a string representation of this abuse severity.voidwriteBytes(OutputStream out) Writes the severity level to a stream.Methods inherited from class DataStructureImpl
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArrayModifier and TypeMethodDescriptionCalculate the SHA256 value of this object (useful for a few scenarios).voidfromBase64(String data) Load the structure from the provided base64 string.voidfromByteArray(byte[] data) Loads structure from the data providedprotected intread(InputStream in, byte[] target) Repeated reads until buffer is full or IOException is thrown.toBase64()Render the structure into modified base 64 notation.byte[]Convert the structure to a byte array.
Field Details
_severityId
private int _severityIdNumeric severity level.
Constructor Details
AbuseSeverity
public AbuseSeverity()Create a new abuse severity with default value -1.
Method Details
getSeverity
public int getSeverity()Severity level of the abuse.- Returns:
- the severity level
setSeverity
public void setSeverity(int id) New severity level of the abuse.- Parameters:
id- the severity level
readBytes
Reads the severity level from a stream.- Parameters:
in- stream to read from- Throws:
DataFormatException- if the data is improperly formattedIOException- if there was a problem reading the stream
writeBytes
Writes the severity level to a stream.- Parameters:
out- stream to write to- Throws:
DataFormatException- if the data was incomplete or not yet ready to be writtenIOException- if there was a problem writing to the stream
equals
hashCode
toString