- java.lang.Object
- 
- javax.net.ssl.SSLEngineResult
 
- 
 public class SSLEngineResult extends Object An encapsulation of the result state produced bySSLEngineI/O calls.A SSLEngineprovides a means for establishing secure communication sessions between two peers.SSLEngineoperations typically consume bytes from an input buffer and produce bytes in an output buffer. This class provides operational result values describing the state of theSSLEngine, including indications of what operations are needed to finish an ongoing handshake. Lastly, it reports the number of bytes consumed and produced as a result of this operation.- Since:
- 1.5
- See Also:
- SSLEngine,- SSLEngine.wrap(ByteBuffer, ByteBuffer),- SSLEngine.unwrap(ByteBuffer, ByteBuffer)
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSSLEngineResult.HandshakeStatusAnSSLEngineResultenum describing the current handshaking state of thisSSLEngine.static classSSLEngineResult.StatusAnSSLEngineResultenum describing the overall result of theSSLEngineoperation.
 - 
Constructor SummaryConstructors Constructor Description SSLEngineResult(SSLEngineResult.Status status, SSLEngineResult.HandshakeStatus handshakeStatus, int bytesConsumed, int bytesProduced)Initializes a new instance of this class.SSLEngineResult(SSLEngineResult.Status status, SSLEngineResult.HandshakeStatus handshakeStatus, int bytesConsumed, int bytesProduced, long sequenceNumber)Initializes a new instance of this class.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intbytesConsumed()Returns the number of bytes consumed from the input buffer.intbytesProduced()Returns the number of bytes written to the output buffer.SSLEngineResult.HandshakeStatusgetHandshakeStatus()Gets the handshake status of thisSSLEngineoperation.SSLEngineResult.StatusgetStatus()Gets the return value of thisSSLEngineoperation.longsequenceNumber()Returns the sequence number of the produced or consumed SSL/TLS/DTLS record (optional operation).StringtoString()Returns a String representation of this object.
 
- 
- 
- 
Constructor Detail- 
SSLEngineResultpublic SSLEngineResult(SSLEngineResult.Status status, SSLEngineResult.HandshakeStatus handshakeStatus, int bytesConsumed, int bytesProduced) Initializes a new instance of this class.- Parameters:
- status- the return value of the operation.
- handshakeStatus- the current handshaking status.
- bytesConsumed- the number of bytes consumed from the source ByteBuffer
- bytesProduced- the number of bytes placed into the destination ByteBuffer
- Throws:
- IllegalArgumentException- if the- statusor- handshakeStatusarguments are null, or if- bytesConsumedor- bytesProducedis negative.
 
 - 
SSLEngineResultpublic SSLEngineResult(SSLEngineResult.Status status, SSLEngineResult.HandshakeStatus handshakeStatus, int bytesConsumed, int bytesProduced, long sequenceNumber) Initializes a new instance of this class.- Parameters:
- status- the return value of the operation.
- handshakeStatus- the current handshaking status.
- bytesConsumed- the number of bytes consumed from the source ByteBuffer
- bytesProduced- the number of bytes placed into the destination ByteBuffer
- sequenceNumber- the sequence number (unsigned long) of the produced or consumed SSL/TLS/DTLS record, or- -1Lif no record produced or consumed
- Throws:
- IllegalArgumentException- if the- statusor- handshakeStatusarguments are null, or if- bytesConsumedor- bytesProducedis negative
- Since:
- 9
 
 
- 
 - 
Method Detail- 
getStatuspublic final SSLEngineResult.Status getStatus() Gets the return value of thisSSLEngineoperation.- Returns:
- the return value
 
 - 
getHandshakeStatuspublic final SSLEngineResult.HandshakeStatus getHandshakeStatus() Gets the handshake status of thisSSLEngineoperation.- Returns:
- the handshake status
 
 - 
bytesConsumedpublic final int bytesConsumed() Returns the number of bytes consumed from the input buffer.- Returns:
- the number of bytes consumed.
 
 - 
bytesProducedpublic final int bytesProduced() Returns the number of bytes written to the output buffer.- Returns:
- the number of bytes produced
 
 - 
sequenceNumberpublic final long sequenceNumber() Returns the sequence number of the produced or consumed SSL/TLS/DTLS record (optional operation).- API Note:
- Note that sequence number is an unsigned long and cannot
           exceed -1L. It is desired to use the unsigned long comparing mode for comparison of unsigned long values (see alsoLong.compareUnsigned()).For DTLS protocols, the first 16 bits of the sequence number is a counter value (epoch) that is incremented on every cipher state change. The remaining 48 bits on the right side of the sequence number represents the sequence of the record, which is maintained separately for each epoch. 
- Implementation Note:
- It is recommended that providers should never allow the
           sequence number incremented to -1L. If the sequence number is close to wrapping, renegotiate should be requested, otherwise the connection should be closed immediately. This should be carried on automatically by the underlying implementation.
- Returns:
- the sequence number of the produced or consumed SSL/TLS/DTLS
          record; or -1Lif no record is produced or consumed, or this operation is not supported by the underlying provider
- Since:
- 9
- See Also:
- Long.compareUnsigned(long, long)
 
 
- 
 
-