public final class StreamContext extends Object implements Resetable
StreamContext captures state of the ongoing XMPP stream state. It
contains all the vital attributes of the XMPP stream such as stream state,
negotiated features, security, id, language, charset and version.
This implementation is thread-safe.
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_RESUMPTION_TIME
Streams which have stream management enabled can be resumed.
|
static String |
STREAM_LANG
Default language for the stream; it's English
|
static String |
STREAM_VERSION
Default value of the XMPP stream version a
|
static String |
UTF8
XMPP protocol uses UTF-8 character encoding
|
| Constructor and Description |
|---|
StreamContext()
Default constructor which enables stream management and max resumption
time is set to
MAX_RESUMPTION_TIME |
StreamContext(boolean smSupported,
int maxResumptionTime)
Instantiate StreamContext with given max stream resumption time (in secs)
and a flag to indicate of the stream management is supported
|
| Modifier and Type | Method and Description |
|---|---|
void |
enableStreamManagement(boolean isResumeable,
int maxResumptionTimeInMillis) |
int |
getAckReceivedCount() |
String |
getEncoding() |
int |
getHandledStanzaCount() |
String |
getLang() |
int |
getMaxResumptionTimeInSecs() |
SASLFeature.SASLMechanism |
getSaslMechanism() |
StreamState |
getState() |
String |
getStreamId() |
String |
getVersion() |
void |
increaseHandledStanzaCount() |
boolean |
isReadyForUsePackets()
Check if this stream is ready for sending/receiving user packets.
|
boolean |
isResumable() |
boolean |
isSmEnabled() |
boolean |
isSMSupported() |
void |
reset(boolean full)
Flushes out data, repositions counters and markers held by this object
|
void |
setAckReceivedCount(int ackReceivedCount) |
void |
setEncoding(String encoding) |
void |
setHandledStanzaCount(int handledStanzaCount) |
void |
setLang(String lang) |
void |
setMaxResumptionTimeInSecs(int maxResumptionTimeInSecs) |
void |
setResumable(boolean resumable) |
void |
setSaslMechanism(SASLFeature.SASLMechanism saslMechanism) |
void |
setSmEnabled(boolean smEnabled) |
void |
setSMSupported(boolean isSMSupported) |
void |
setState(StreamState state) |
void |
setStreamId(String streamId) |
void |
setStreamState(Packet packet) |
void |
setVersion(String version) |
public static final String UTF8
public static final String STREAM_LANG
public static final String STREAM_VERSION
public static final int MAX_RESUMPTION_TIME
public StreamContext()
MAX_RESUMPTION_TIMEpublic StreamContext(boolean smSupported,
int maxResumptionTime)
smSupported - flag to indicate if stream management is supportedmaxResumptionTime - max resumtpion time in secondspublic String getStreamId()
public void setStreamId(String streamId)
public StreamState getState()
public void setState(StreamState state)
public SASLFeature.SASLMechanism getSaslMechanism()
public void setSaslMechanism(SASLFeature.SASLMechanism saslMechanism)
public String getEncoding()
public void setEncoding(String encoding)
public String getVersion()
public void setVersion(String version)
public String getLang()
public void setLang(String lang)
public boolean isSMSupported()
public void setSMSupported(boolean isSMSupported)
public boolean isSmEnabled()
public void setSmEnabled(boolean smEnabled)
public boolean isResumable()
public void setResumable(boolean resumable)
public void increaseHandledStanzaCount()
public int getHandledStanzaCount()
public void setHandledStanzaCount(int handledStanzaCount)
public int getAckReceivedCount()
public void setAckReceivedCount(int ackReceivedCount)
public void setStreamState(Packet packet)
public int getMaxResumptionTimeInSecs()
public void setMaxResumptionTimeInSecs(int maxResumptionTimeInSecs)
public void enableStreamManagement(boolean isResumeable,
int maxResumptionTimeInMillis)
public void reset(boolean full)
Resetablepublic boolean isReadyForUsePackets()
Copyright © 2019. All rights reserved.