_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q20900
StringUtils.isNotEmpty
train
public static boolean isNotEmpty(CharSequence... css) { for (CharSequence cs : css) { if (StringUtils.isNullOrEmpty(cs)) { return false; } } return true; }
java
{ "resource": "" }
q20901
StringUtils.toStringBuilder
train
public static StringBuilder toStringBuilder(Collection<? extends Object> collection, String delimiter) { StringBuilder sb = new StringBuilder(collection.size() * 20); for (Iterator<? extends Object> it = collection.iterator(); it.hasNext();) { Object cs = it.next(); sb.append(cs)...
java
{ "resource": "" }
q20902
FromMatchesFilter.create
train
public static FromMatchesFilter create(Jid address) { return new FromMatchesFilter(address, address != null ? address.hasNoResource() : false) ; }
java
{ "resource": "" }
q20903
XDataManager.getInstanceFor
train
public static synchronized XDataManager getInstanceFor(XMPPConnection connection) { XDataManager xDataManager = INSTANCES.get(connection); if (xDataManager == null) { xDataManager = new XDataManager(connection); INSTANCES.put(connection, xDataManager); } return xD...
java
{ "resource": "" }
q20904
ConsistentColor.RGBFrom
train
public static float[] RGBFrom(CharSequence input, ConsistentColorSettings settings) { double angle = createAngle(input); double correctedAngle = applyColorDeficiencyCorrection(angle, settings.getDeficiency()); double[] CbCr = angleToCbCr(correctedAngle); float[] rgb = CbCrToRGB(CbCr, Y);...
java
{ "resource": "" }
q20905
LeafNode.getItems
train
public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getItems((List<ExtensionElement>) null, null); }
java
{ "resource": "" }
q20906
LeafNode.getItems
train
public <T extends Item> List<T> getItems(String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), subscriptionId)); return getItems(request); }
java
{ "resource": "" }
q20907
LeafNode.send
train
@SuppressWarnings("unchecked") @Deprecated public <T extends Item> void send(T item) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException { publish(item); }
java
{ "resource": "" }
q20908
LeafNode.publish
train
public void publish() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId())); pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow()...
java
{ "resource": "" }
q20909
LeafNode.publish
train
@SuppressWarnings("unchecked") public <T extends Item> void publish(T item) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Collection<T> items = new ArrayList<>(1); items.add((item == null ? (T) new Item() : item)); publish(items); }
java
{ "resource": "" }
q20910
LeafNode.deleteAllItems
train
public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub request = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PURGE_OWNER, getId())); pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextRe...
java
{ "resource": "" }
q20911
LeafNode.deleteItem
train
public void deleteItem(String itemId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Collection<String> items = new ArrayList<>(1); items.add(itemId); deleteItem(items); }
java
{ "resource": "" }
q20912
LeafNode.deleteItem
train
public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { List<Item> items = new ArrayList<>(itemIds.size()); for (String id : itemIds) { items.add(new Item(id)); } PubSub request = creat...
java
{ "resource": "" }
q20913
OpenPgpManager.generateAndImportKeyPair
train
public OpenPgpV4Fingerprint generateAndImportKeyPair(BareJid ourJid) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, NoSuchProviderException, PGPException, IOException { throwIfNoProviderSet(); OpenPgpStore store = provider.getStore(); PGPKeyRing key...
java
{ "resource": "" }
q20914
OpenPgpManager.serverSupportsSecretKeyBackups
train
public static boolean serverSupportsSecretKeyBackups(XMPPConnection connection) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException { return ServiceDiscoveryManager.getInstanceFor(connection) ...
java
{ "resource": "" }
q20915
OpenPgpManager.backupSecretKeyToServer
train
public void backupSecretKeyToServer(DisplayBackupCodeCallback displayCodeCallback, SecretKeyBackupSelectionCallback selectKeyCallback) throws InterruptedException, PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException, SmackException.NotC...
java
{ "resource": "" }
q20916
OpenPgpManager.restoreSecretKeyServerBackup
train
public OpenPgpV4Fingerprint restoreSecretKeyServerBackup(AskForBackupCodeCallback codeCallback) throws InterruptedException, PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException, InvalidBacku...
java
{ "resource": "" }
q20917
PrivacyItem.toXML
train
public String toXML() { StringBuilder buf = new StringBuilder(); buf.append("<item"); if (this.isAllow()) { buf.append(" action=\"allow\""); } else { buf.append(" action=\"deny\""); } buf.append(" order=\"").append(getOrder()).append('"'); if (ge...
java
{ "resource": "" }
q20918
IntrospectionProvider.decode
train
private static Object decode(Class<?> type, String value) throws ClassNotFoundException { String name = type.getName(); switch (name) { case "java.lang.String": return value; case "boolean": // CHECKSTYLE:OFF return Boolean.valueOf(value); ...
java
{ "resource": "" }
q20919
XHTMLManager.getBodies
train
public static List<CharSequence> getBodies(Message message) { XHTMLExtension xhtmlExtension = XHTMLExtension.from(message); if (xhtmlExtension != null) return xhtmlExtension.getBodies(); else return null; }
java
{ "resource": "" }
q20920
XHTMLManager.addBody
train
public static void addBody(Message message, XHTMLText xhtmlText) { XHTMLExtension xhtmlExtension = XHTMLExtension.from(message); if (xhtmlExtension == null) { // Create an XHTMLExtension and add it to the message xhtmlExtension = new XHTMLExtension(); message.addExten...
java
{ "resource": "" }
q20921
XHTMLManager.isXHTMLMessage
train
public static boolean isXHTMLMessage(Message message) { return message.getExtension(XHTMLExtension.ELEMENT, XHTMLExtension.NAMESPACE) != null; }
java
{ "resource": "" }
q20922
XHTMLManager.isServiceEnabled
train
public static boolean isServiceEnabled(XMPPConnection connection, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, XHTMLExtension.NAMESPACE); }
java
{ "resource": "" }
q20923
FileBasedOmemoStore.deleteDirectory
train
public static void deleteDirectory(File root) { File[] currList; Stack<File> stack = new Stack<>(); stack.push(root); while (!stack.isEmpty()) { if (stack.lastElement().isDirectory()) { currList = stack.lastElement().listFiles(); if (currList !...
java
{ "resource": "" }
q20924
LazyStringBuilder.getAsList
train
public List<CharSequence> getAsList() { if (cache != null) { return Collections.singletonList((CharSequence) cache); } return Collections.unmodifiableList(list); }
java
{ "resource": "" }
q20925
XmlStringBuilder.attribute
train
public XmlStringBuilder attribute(String name, String value) { assert value != null; sb.append(' ').append(name).append("='"); escapeAttributeValue(value); sb.append('\''); return this; }
java
{ "resource": "" }
q20926
FileTransfer.isDone
train
public boolean isDone() { return status == Status.cancelled || status == Status.error || status == Status.complete || status == Status.refused; }
java
{ "resource": "" }
q20927
SimpleDirectoryPersistentCache.writeInfoToFile
train
private static void writeInfoToFile(File file, DiscoverInfo info) throws IOException { try (DataOutputStream dos = new DataOutputStream(new FileOutputStream(file))) { dos.writeUTF(info.toXML().toString()); } }
java
{ "resource": "" }
q20928
SimpleDirectoryPersistentCache.restoreInfoFromFile
train
private static DiscoverInfo restoreInfoFromFile(File file) throws Exception { String fileContent; try (DataInputStream dis = new DataInputStream(new FileInputStream(file))) { fileContent = dis.readUTF(); } if (fileContent == null) { return null; } ...
java
{ "resource": "" }
q20929
JingleSessionStateEnded.processJingle
train
@Override public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) { IQ response; response = session.createJingleError(jingle, JingleError.MALFORMED_STANZA); return response; }
java
{ "resource": "" }
q20930
OmemoCachedDeviceList.merge
train
public void merge(Set<Integer> deviceListUpdate) { inactiveDevices.addAll(activeDevices); activeDevices.clear(); activeDevices.addAll(deviceListUpdate); inactiveDevices.removeAll(activeDevices); }
java
{ "resource": "" }
q20931
XHTMLText.appendOpenAnchorTag
train
public XHTMLText appendOpenAnchorTag(String href, String style) { text.halfOpenElement(A); text.optAttribute(HREF, href); text.optAttribute(STYLE, style); text.rightAngleBracket(); return this; }
java
{ "resource": "" }
q20932
XHTMLText.appendOpenBlockQuoteTag
train
public XHTMLText appendOpenBlockQuoteTag(String style) { text.halfOpenElement(BLOCKQUOTE); text.optAttribute(STYLE, style); text.rightAngleBracket(); return this; }
java
{ "resource": "" }
q20933
XHTMLText.appendOpenBodyTag
train
private XHTMLText appendOpenBodyTag(String style, String lang) { text.halfOpenElement(Message.BODY); text.xmlnsAttribute(NAMESPACE); text.optElement(STYLE, style); text.xmllangAttribute(lang); text.rightAngleBracket(); return this; }
java
{ "resource": "" }
q20934
XHTMLText.appendOpenHeaderTag
train
public XHTMLText appendOpenHeaderTag(int level, String style) { if (level > 3 || level < 1) { throw new IllegalArgumentException("Level must be between 1 and 3"); } text.halfOpenElement(H + Integer.toString(level)); text.optAttribute(STYLE, style); text.rightAngleBrac...
java
{ "resource": "" }
q20935
XHTMLText.appendCloseHeaderTag
train
public XHTMLText appendCloseHeaderTag(int level) { if (level > 3 || level < 1) { throw new IllegalArgumentException("Level must be between 1 and 3"); } text.closeElement(H + Integer.toBinaryString(level)); return this; }
java
{ "resource": "" }
q20936
XHTMLText.appendImageTag
train
public XHTMLText appendImageTag(String align, String alt, String height, String src, String width) { text.halfOpenElement(IMG); text.optAttribute("align", align); text.optAttribute("alt", alt); text.optAttribute("height", height); text.optAttribute("src", src); text.optAt...
java
{ "resource": "" }
q20937
XHTMLText.appendLineItemTag
train
public XHTMLText appendLineItemTag(String style) { text.halfOpenElement(LI); text.optAttribute(STYLE, style); text.rightAngleBracket(); return this; }
java
{ "resource": "" }
q20938
XHTMLText.appendOpenOrderedListTag
train
public XHTMLText appendOpenOrderedListTag(String style) { text.halfOpenElement(OL); text.optAttribute(STYLE, style); text.rightAngleBracket(); return this; }
java
{ "resource": "" }
q20939
XHTMLText.appendOpenUnorderedListTag
train
public XHTMLText appendOpenUnorderedListTag(String style) { text.halfOpenElement(UL); text.optAttribute(STYLE, style); text.rightAngleBracket(); return this; }
java
{ "resource": "" }
q20940
XHTMLText.appendOpenParagraphTag
train
public XHTMLText appendOpenParagraphTag(String style) { text.halfOpenElement(P); text.optAttribute(STYLE, style); text.rightAngleBracket(); return this; }
java
{ "resource": "" }
q20941
XHTMLText.appendOpenInlinedQuoteTag
train
public XHTMLText appendOpenInlinedQuoteTag(String style) { text.halfOpenElement(Q); text.optAttribute(STYLE, style); text.rightAngleBracket(); return this; }
java
{ "resource": "" }
q20942
XHTMLText.appendOpenSpanTag
train
public XHTMLText appendOpenSpanTag(String style) { text.halfOpenElement(SPAN); text.optAttribute(STYLE, style); text.rightAngleBracket(); return this; }
java
{ "resource": "" }
q20943
Node.getSubscriptions
train
public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getSubscriptions(null, null); }
java
{ "resource": "" }
q20944
Node.getSubscriptionsAsOwner
train
public List<Subscription> getSubscriptionsAsOwner() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getSubscriptionsAsOwner(null, null); }
java
{ "resource": "" }
q20945
Node.getAffiliations
train
public List<Affiliation> getAffiliations() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getAffiliations(null, null); }
java
{ "resource": "" }
q20946
Node.getAffiliationsAsOwner
train
public List<Affiliation> getAffiliationsAsOwner() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getAffiliationsAsOwner(null, null); }
java
{ "resource": "" }
q20947
Node.subscribe
train
public Subscription subscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub pubSub = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId())); PubSub reply = sendPubsubPacket(pubSub); return reply.getExtension(PubSubEle...
java
{ "resource": "" }
q20948
Node.subscribe
train
public Subscription subscribe(String jid, SubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub request = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId())); request.addExtension(new FormNode(FormNodeType.OPTIONS, subF...
java
{ "resource": "" }
q20949
Node.unsubscribe
train
public void unsubscribe(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { sendPubsubPacket(createPubsubPacket(Type.set, new UnsubscribeExtension(jid, getId(), subscriptionId))); }
java
{ "resource": "" }
q20950
Node.getSubscriptionOptions
train
public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub packet = sendPubsubPacket(createPubsubPacket(Type.get, new OptionsExtension(jid, getId(), subscriptionId))); FormNode ext = ...
java
{ "resource": "" }
q20951
Node.addItemEventListener
train
@SuppressWarnings("unchecked") public void addItemEventListener(@SuppressWarnings("rawtypes") ItemEventListener listener) { StanzaListener conListener = new ItemEventTranslator(listener); itemEventToListenerMap.put(listener, conListener); pubSubManager.getConnection().addSyncStanzaListener(c...
java
{ "resource": "" }
q20952
Node.removeItemEventListener
train
public void removeItemEventListener(@SuppressWarnings("rawtypes") ItemEventListener listener) { StanzaListener conListener = itemEventToListenerMap.remove(listener); if (conListener != null) pubSubManager.getConnection().removeSyncStanzaListener(conListener); }
java
{ "resource": "" }
q20953
Node.addConfigurationListener
train
public void addConfigurationListener(NodeConfigListener listener) { StanzaListener conListener = new NodeConfigTranslator(listener); configEventToListenerMap.put(listener, conListener); pubSubManager.getConnection().addSyncStanzaListener(conListener, new EventContentFilter(EventElementType.confi...
java
{ "resource": "" }
q20954
Node.removeConfigurationListener
train
public void removeConfigurationListener(NodeConfigListener listener) { StanzaListener conListener = configEventToListenerMap .remove(listener); if (conListener != null) pubSubManager.getConnection().removeSyncStanzaListener(conListener); }
java
{ "resource": "" }
q20955
Node.addItemDeleteListener
train
public void addItemDeleteListener(ItemDeleteListener listener) { StanzaListener delListener = new ItemDeleteTranslator(listener); itemDeleteToListenerMap.put(listener, delListener); EventContentFilter deleteItem = new EventContentFilter(EventElementType.items.toString(), "retract"); Even...
java
{ "resource": "" }
q20956
Node.removeItemDeleteListener
train
public void removeItemDeleteListener(ItemDeleteListener listener) { StanzaListener conListener = itemDeleteToListenerMap .remove(listener); if (conListener != null) pubSubManager.getConnection().removeSyncStanzaListener(conListener); }
java
{ "resource": "" }
q20957
TransportNegotiator.setAcceptedLocalCandidate
train
private void setAcceptedLocalCandidate(TransportCandidate bestLocalCandidate) { for (int i = 0; i < resolver.getCandidateCount(); i++) { // TODO FIX The EQUAL Sentence if (resolver.getCandidate(i).getIp().equals(bestLocalCandidate.getIp()) && resolver.getCandidate(i)....
java
{ "resource": "" }
q20958
TransportNegotiator.doStart
train
@Override protected void doStart() { try { sendTransportCandidatesOffer(); setNegotiatorState(JingleNegotiatorState.PENDING); } catch (Exception e) { // TODO Auto-generated catch block LOGGER.log(Level.WARNING, "exception", e); } }
java
{ "resource": "" }
q20959
TransportNegotiator.addRemoteCandidate
train
private void addRemoteCandidate(TransportCandidate rc) { // Add the candidate to the list if (rc != null) { if (acceptableTransportCandidate(rc, offeredCandidates)) { synchronized (remoteCandidates) { remoteCandidates.add(rc); } ...
java
{ "resource": "" }
q20960
TransportNegotiator.checkRemoteCandidate
train
private void checkRemoteCandidate(final TransportCandidate offeredCandidate) { offeredCandidate.addListener(new TransportResolverListener.Checker() { @Override public void candidateChecked(TransportCandidate cand, final boolean validCandidate) { if (validCandidate) { ...
java
{ "resource": "" }
q20961
TransportNegotiator.addValidRemoteCandidate
train
private void addValidRemoteCandidate(TransportCandidate remoteCandidate) { // Add the candidate to the list if (remoteCandidate != null) { synchronized (validRemoteCandidates) { LOGGER.fine("Added valid candidate: " + remoteCandidate.getIp() + ":" + remoteCandidate.getPort())...
java
{ "resource": "" }
q20962
TransportNegotiator.obtainCandidatesList
train
private List<TransportCandidate> obtainCandidatesList(Jingle jingle) { List<TransportCandidate> result = new ArrayList<>(); if (jingle != null) { // Get the list of candidates from the packet for (JingleContent jingleContent : jingle.getContentsList()) { if (jing...
java
{ "resource": "" }
q20963
TransportNegotiator.sendTransportCandidateOffer
train
private synchronized void sendTransportCandidateOffer(TransportCandidate cand) throws NotConnectedException, InterruptedException { if (!cand.isNull()) { // Offer our new candidate... addOfferedCandidate(cand); JingleContent content = parentNegotiator.getJingleContent(); ...
java
{ "resource": "" }
q20964
TransportNegotiator.sendTransportCandidatesOffer
train
private void sendTransportCandidatesOffer() throws XMPPException, SmackException, InterruptedException { List<TransportCandidate> notOffered = resolver.getCandidatesList(); notOffered.removeAll(offeredCandidates); // Send any unset candidate for (Object aNotOffered : notOffered) { ...
java
{ "resource": "" }
q20965
TransportNegotiator.receiveContentAcceptAction
train
private IQ receiveContentAcceptAction(Jingle jingle) throws XMPPException { IQ response = null; // Parse the Jingle and get the accepted candidate List<TransportCandidate> accepted = obtainCandidatesList(jingle); if (!accepted.isEmpty()) { for (TransportCandidate cand : acc...
java
{ "resource": "" }
q20966
TransportNegotiator.triggerTransportEstablished
train
private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException { List<JingleListener> listeners = getListenersList(); for (JingleListener li : listeners) { if (li instanceof JingleTransportListener) { ...
java
{ "resource": "" }
q20967
TransportNegotiator.triggerTransportClosed
train
private void triggerTransportClosed(TransportCandidate cand) { List<JingleListener> listeners = getListenersList(); for (JingleListener li : listeners) { if (li instanceof JingleTransportListener) { JingleTransportListener mli = (JingleTransportListener) li; m...
java
{ "resource": "" }
q20968
StanzaCollector.cancel
train
public synchronized void cancel() { // If the packet collector has already been cancelled, do nothing. if (cancelled) { return; } cancelled = true; connection.removeStanzaCollector(this); notifyAll(); if (collectorToReset != null) { colle...
java
{ "resource": "" }
q20969
StanzaCollector.getCollectedStanzasAfterCancelled
train
public List<Stanza> getCollectedStanzasAfterCancelled() { if (!cancelled) { throw new IllegalStateException("Stanza collector was not yet cancelled"); } if (collectedCache == null) { collectedCache = new ArrayList<>(getCollectedCount()); collectedCache.addAll...
java
{ "resource": "" }
q20970
StanzaCollector.processStanza
train
protected void processStanza(Stanza packet) { if (packetFilter == null || packetFilter.accept(packet)) { synchronized (this) { if (resultQueue.size() == maxQueueSize) { Stanza rolledOverStanza = resultQueue.poll(); assert rolledOverStanza != nu...
java
{ "resource": "" }
q20971
ServerPingWithAlarmManager.onCreate
train
public static void onCreate(Context context) { sContext = context; context.registerReceiver(ALARM_BROADCAST_RECEIVER, new IntentFilter(PING_ALARM_ACTION)); sAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); sPendingIntent = PendingIntent.getBroadcast(context,...
java
{ "resource": "" }
q20972
DefaultExtensionElement.getNames
train
public synchronized Collection<String> getNames() { if (map == null) { return Collections.emptySet(); } return Collections.unmodifiableSet(new HashMap<String,String>(map).keySet()); }
java
{ "resource": "" }
q20973
DefaultExtensionElement.getValue
train
public synchronized String getValue(String name) { if (map == null) { return null; } return map.get(name); }
java
{ "resource": "" }
q20974
DefaultExtensionElement.setValue
train
public synchronized void setValue(String name, String value) { if (map == null) { map = new HashMap<String,String>(); } map.put(name, value); }
java
{ "resource": "" }
q20975
LiteDebugger.rootWindowClosing
train
public void rootWindowClosing(WindowEvent evt) { // TODO: Remove debugger from connection. ((ObservableReader) reader).removeReaderListener(readerListener); ((ObservableWriter) writer).removeWriterListener(writerListener); }
java
{ "resource": "" }
q20976
JingleSession.generateSessionId
train
protected static String generateSessionId() { return String.valueOf(randomGenerator.nextInt(Integer.MAX_VALUE) + randomGenerator.nextInt(Integer.MAX_VALUE)); }
java
{ "resource": "" }
q20977
JingleSession.setSessionState
train
public void setSessionState(JingleSessionState stateIs) { LOGGER.fine("Session state change: " + sessionState + "->" + stateIs); stateIs.enter(); sessionState = stateIs; }
java
{ "resource": "" }
q20978
JingleSession.isFullyEstablished
train
public boolean isFullyEstablished() { boolean result = true; for (ContentNegotiator contentNegotiator : contentNegotiators) { if (!contentNegotiator.isFullyEstablished()) result = false; } return result; }
java
{ "resource": "" }
q20979
JingleSession.receivePacketAndRespond
train
public synchronized void receivePacketAndRespond(IQ iq) throws XMPPException, SmackException, InterruptedException { List<IQ> responses = new ArrayList<>(); String responseId; LOGGER.fine("Packet: " + iq.toXML()); try { // Dispatch the packet to the JingleNegotiators and ...
java
{ "resource": "" }
q20980
JingleSession.sendFormattedJingle
train
public Jingle sendFormattedJingle(IQ iq, Jingle jout) throws NotConnectedException, InterruptedException { if (jout != null) { if (jout.getInitiator() == null) { jout.setInitiator(getInitiator()); } if (jout.getResponder() == null) { jout.setR...
java
{ "resource": "" }
q20981
JingleSession.createAck
train
public IQ createAck(IQ iq) { IQ result = null; if (iq != null) { // Don't acknowledge ACKs, errors... if (iq.getType().equals(IQ.Type.set)) { IQ ack = IQ.createResultIQ(iq); // No! Don't send it. Let it flow to the normal way IQ results get proc...
java
{ "resource": "" }
q20982
JingleSession.getInstanceFor
train
public static synchronized JingleSession getInstanceFor(XMPPConnection con) { if (con == null) { throw new IllegalArgumentException("XMPPConnection cannot be null"); } JingleSession result = null; synchronized (sessions) { if (sessions.containsKey(con)) { ...
java
{ "resource": "" }
q20983
JingleSession.installConnectionListeners
train
private void installConnectionListeners(final XMPPConnection connection) { if (connection != null) { connectionListener = new AbstractConnectionClosedListener() { @Override public void connectionTerminated() { unregisterInstanceFor(connection); ...
java
{ "resource": "" }
q20984
JingleSession.updatePacketListener
train
protected void updatePacketListener() { removeAsyncPacketListener(); LOGGER.fine("UpdatePacketListener"); packetListener = new StanzaListener() { @Override public void processStanza(Stanza packet) { try { receivePacketAndRespond((IQ) ...
java
{ "resource": "" }
q20985
JingleSession.addMediaListener
train
public void addMediaListener(JingleMediaListener li) { for (ContentNegotiator contentNegotiator : contentNegotiators) { if (contentNegotiator.getMediaNegotiator() != null) { contentNegotiator.getMediaNegotiator().addListener(li); } } }
java
{ "resource": "" }
q20986
JingleSession.removeMediaListener
train
public void removeMediaListener(JingleMediaListener li) { for (ContentNegotiator contentNegotiator : contentNegotiators) { if (contentNegotiator.getMediaNegotiator() != null) { contentNegotiator.getMediaNegotiator().removeListener(li); } } }
java
{ "resource": "" }
q20987
JingleSession.addTransportListener
train
public void addTransportListener(JingleTransportListener li) { for (ContentNegotiator contentNegotiator : contentNegotiators) { if (contentNegotiator.getTransportNegotiator() != null) { contentNegotiator.getTransportNegotiator().addListener(li); } } }
java
{ "resource": "" }
q20988
JingleSession.removeTransportListener
train
public void removeTransportListener(JingleTransportListener li) { for (ContentNegotiator contentNegotiator : contentNegotiators) { if (contentNegotiator.getTransportNegotiator() != null) { contentNegotiator.getTransportNegotiator().removeListener(li); } } }
java
{ "resource": "" }
q20989
JingleSession.setupListeners
train
public void setupListeners() { JingleMediaListener jingleMediaListener = new JingleMediaListener() { @Override public void mediaClosed(PayloadType cand) { } @Override public void mediaEstablished(PayloadType pt) throws NotConnectedException, Interrup...
java
{ "resource": "" }
q20990
JingleSession.triggerSessionClosed
train
protected void triggerSessionClosed(String reason) { // for (ContentNegotiator contentNegotiator : contentNegotiators) { // // contentNegotiator.stopJingleMediaSession(); // // for (TransportCandidate candidate : contentNegotiator.getTransportNegotiat...
java
{ "resource": "" }
q20991
JingleSession.triggerSessionClosedOnError
train
protected void triggerSessionClosedOnError(XMPPException exc) { for (ContentNegotiator contentNegotiator : contentNegotiators) { contentNegotiator.stopJingleMediaSession(); for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates()) ...
java
{ "resource": "" }
q20992
JingleSession.triggerMediaReceived
train
protected void triggerMediaReceived(String participant) { List<JingleListener> listeners = getListenersList(); for (JingleListener li : listeners) { if (li instanceof JingleSessionListener) { JingleSessionListener sli = (JingleSessionListener) li; sli.sessionM...
java
{ "resource": "" }
q20993
JingleSession.terminate
train
public void terminate(String reason) throws XMPPException, NotConnectedException, InterruptedException { if (isClosed()) return; LOGGER.fine("Terminate " + reason); Jingle jout = new Jingle(JingleActionEnum.SESSION_TERMINATE); jout.setType(IQ.Type.set); sendStanza(jou...
java
{ "resource": "" }
q20994
JingleSession.close
train
@Override public void close() { if (isClosed()) return; // Set the session state to ENDED. setSessionState(JingleSessionStateEnded.getInstance()); for (ContentNegotiator contentNegotiator : contentNegotiators) { contentNegotiator.stopJingleMediaSession(); ...
java
{ "resource": "" }
q20995
JingleSession.createJingleError
train
public IQ createJingleError(IQ iq, JingleError jingleError) { IQ errorPacket = null; if (jingleError != null) { // TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways StanzaError.Builder builder = StanzaError.getBuilder(StanzaError.C...
java
{ "resource": "" }
q20996
JingleSession.startOutgoing
train
public void startOutgoing() throws IllegalStateException, SmackException, InterruptedException { updatePacketListener(); setSessionState(JingleSessionStatePending.getInstance()); Jingle jingle = new Jingle(JingleActionEnum.SESSION_INITIATE); // Create a content negotiator for each med...
java
{ "resource": "" }
q20997
JingleSession.startNegotiators
train
private void startNegotiators() { for (ContentNegotiator contentNegotiator : contentNegotiators) { TransportNegotiator transNeg = contentNegotiator.getTransportNegotiator(); transNeg.start(); } }
java
{ "resource": "" }
q20998
Presence.cloneWithNewId
train
public Presence cloneWithNewId() { Presence clone = clone(); clone.setStanzaId(StanzaIdUtil.newStanzaId()); return clone; }
java
{ "resource": "" }
q20999
OutgoingFileTransfer.sendFile
train
public synchronized OutputStream sendFile(String fileName, long fileSize, String description) throws XMPPException, SmackException, InterruptedException { if (isDone() || outputStream != null) { throw new IllegalStateException( "The negotiation process has already" ...
java
{ "resource": "" }