当前位置: 首页>>代码示例>>Java>>正文


Java InvalidArgumentException类代码示例

本文整理汇总了Java中javax.sip.InvalidArgumentException的典型用法代码示例。如果您正苦于以下问题:Java InvalidArgumentException类的具体用法?Java InvalidArgumentException怎么用?Java InvalidArgumentException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InvalidArgumentException类属于javax.sip包,在下文中一共展示了InvalidArgumentException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeContentLength

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Compute and set the Content-length header based on the given content object.
 *
 * @param content is the content, as String, array of bytes, or other object.
 */
private void computeContentLength(Object content) {
    int length = 0;
    if (content != null) {
        if (content instanceof String) {
            try {
                length = ((String) content).getBytes( getCharset() ).length;
            } catch (UnsupportedEncodingException ex) {
                InternalErrorHandler.handleException(ex);
            }
        } else if (content instanceof byte[]) {
            length = ((byte[]) content).length;
        } else {
            length = content.toString().length();
        }
    }

    try {
        contentLengthHeader.setContentLength(length);
    } catch (InvalidArgumentException e) {
        // Cannot happen.
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:28,代码来源:SIPMessage.java

示例2: addHeader

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Add a SIP header.
 *
 * @param sipHeader -- sip header to add.
 */
public void addHeader(Header sipHeader) {
    // Content length is never stored. Just computed.
    SIPHeader sh = (SIPHeader) sipHeader;
    try {
        if ((sipHeader instanceof ViaHeader) || (sipHeader instanceof RecordRouteHeader)) {
            attachHeader(sh, false, true);
        } else {
            attachHeader(sh, false, false);
        }
    } catch (SIPDuplicateHeaderException ex) {
        try {
            if (sipHeader instanceof ContentLength) {
                ContentLength cl = (ContentLength) sipHeader;
                contentLengthHeader.setContentLength(cl.getContentLength());
            }
        } catch (InvalidArgumentException e) {
        }
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:25,代码来源:SIPMessage.java

示例3: resendAck

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Resend the last ack.
 */
public void resendAck() throws SipException {
    // Check for null.

    if (this.getLastAckSent() != null) {
        if (getLastAckSent().getHeader(TimeStampHeader.NAME) != null
                && sipStack.generateTimeStampHeader) {
            TimeStamp ts = new TimeStamp();
            try {
                ts.setTimeStamp(System.currentTimeMillis());
                getLastAckSent().setHeader(ts);
            } catch (InvalidArgumentException e) {

            }
        }
        this.sendAck(getLastAckSent(), false);
    } else {
    	if(logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)){
    		logger.logDebug("SIPDialog::resendAck:lastAck sent is NULL hence not resending ACK");
    	}
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:26,代码来源:SIPDialog.java

示例4: createRAckHeader

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Creates a new RAckHeader based on the newly supplied rSeqNumber,
 * cSeqNumber and method values.
 *
 * @param rSeqNumber - the new integer value of the rSeqNumber.
 * @param cSeqNumber - the new integer value of the cSeqNumber.
 * @param method - the new string value of the method.
 * @throws InvalidArgumentException if supplied rSeqNumber or cSeqNumber is
 * less than zero or greater than than 2**31-1.
 * @throws ParseException which signals that an error has been reached
 * unexpectedly while parsing the method value.
 * @return the newly created RAckHeader object.
 * @since v1.1
 */
public RAckHeader createRAckHeader(
    long rSeqNumber,
    long cSeqNumber,
    String method)
    throws InvalidArgumentException, ParseException {
    if (method == null)
        throw new NullPointerException("Bad method");
    if (cSeqNumber < 0 || rSeqNumber < 0)
        throw new InvalidArgumentException("bad cseq/rseq arg");
    RAck rack = new RAck();
    rack.setMethod(method);
    rack.setCSequenceNumber(cSeqNumber);
    rack.setRSequenceNumber(rSeqNumber);

    return rack;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:31,代码来源:HeaderFactoryImpl.java

示例5: removeContent

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Remove the message content if it exists.
 */
public void removeContent() {
    messageContent = null;
    messageContentBytes = null;
    messageContentObject = null;
    try {
        this.contentLengthHeader.setContentLength(0);
    } catch (InvalidArgumentException ex) {
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:13,代码来源:SIPMessage.java

示例6: setContentLength

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Set the content length header.
 *
 * @param contentLength -- content length header.
 */
public void setContentLength(ContentLengthHeader contentLength) {
    try {
        this.contentLengthHeader.setContentLength(contentLength.getContentLength());
    } catch (InvalidArgumentException ex) {
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:13,代码来源:SIPMessage.java

示例7: setSPIServer

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Set Server SPI (spi-s parameter)
 * @param spis - spi-s value
 * @throws InvalidArgumentException - when value is not valid
 */
public void setSPIServer(int spis) throws InvalidArgumentException {
    if (spis < 0)
        throw new InvalidArgumentException(
            "JAIN-SIP "
                + "Exception, SecurityClient, setSPIServer(), the spi-s parameter is <0");
    setParameter(ParameterNamesIms.SPI_S, spis);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:13,代码来源:SecurityAgree.java

示例8: setPortClient

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Set Client Port (port-c parameter)
 * @param portC - port-c value
 * @throws InvalidArgumentException - when value is not valid
 */
public void setPortClient(int portC) throws InvalidArgumentException {
    if (portC < 0)
        throw new InvalidArgumentException(
            "JAIN-SIP "
                + "Exception, SecurityClient, setPortClient(), the port-c parameter is <0");
    setParameter(ParameterNamesIms.PORT_C, portC);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:13,代码来源:SecurityAgree.java

示例9: setPortServer

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Set Server Port (port-s parameter)
 * @param portS - port-s value
 * @throws InvalidArgumentException - when value is not valid
 */
public void setPortServer(int portS) throws InvalidArgumentException {
    if (portS < 0)
        throw new InvalidArgumentException(
            "JAIN-SIP "
                + "Exception, SecurityClient, setPortServer(), the port-s parameter is <0");
    setParameter(ParameterNamesIms.PORT_S, portS);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:13,代码来源:SecurityAgree.java

示例10: setMediaAuthorizationToken

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Set the media authorization token.
 *
 * @param token - media authorization token to set
 * @throws InvalidArgumentException - if token is null or empty
 */
public void setMediaAuthorizationToken(String token) throws InvalidArgumentException
{
    if (token == null || token.length() == 0)
        throw new InvalidArgumentException(" the Media-Authorization-Token parameter is null or empty");

    this.token = token;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:14,代码来源:PMediaAuthorization.java

示例11: setCode

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Sets code of WarningHeader
 * @param code int to set
 * @throws SipParseException if code is not accepted by implementation
 */
public void setCode(int code) throws InvalidArgumentException {
    if (code >99  && code < 1000) { // check this is a 3DIGIT code
        this.code = code;
    } else
        throw new InvalidArgumentException(
            "Code parameter in the Warning header is invalid: code="
                + code);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:14,代码来源:Warning.java

示例12: setMinorVersion

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Sets the Minor-Version argument of this MimeVersionHeader to the supplied
 * <var>minorVersion</var> value.
 *
 * @param minorVersion - the new integer Minor version
 * @throws InvalidArgumentException
 */
public void setMinorVersion(int minorVersion)
    throws InvalidArgumentException {
    if (minorVersion < 0)
        throw new InvalidArgumentException(
            "JAIN-SIP Exception"
                + ", MimeVersion, setMinorVersion(), the minorVersion parameter is null");
    this.minorVersion = minorVersion;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:16,代码来源:MimeVersion.java

示例13: setMajorVersion

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * Sets the Major-Version argument of this MimeVersionHeader to the supplied
 * <var>majorVersion</var> value.
 *
 * @param majorVersion - the new integer Major version
 * @throws InvalidArgumentException
 */
public void setMajorVersion(int majorVersion)
    throws InvalidArgumentException {
    if (majorVersion < 0)
        throw new InvalidArgumentException(
            "JAIN-SIP Exception"
                + ", MimeVersion, setMajorVersion(), the majorVersion parameter is null");
    this.majorVersion = majorVersion;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:16,代码来源:MimeVersion.java

示例14: setSeqNumber

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
public void setSeqNumber(long sequenceNumber) throws InvalidArgumentException {

            if (sequenceNumber <= 0 ||sequenceNumber > ((long)1)<<32 - 1)
                throw new InvalidArgumentException(
                    "Bad seq number " + sequenceNumber);
            this.sequenceNumber = sequenceNumber;

    }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:9,代码来源:RSeq.java

示例15: setQValue

import javax.sip.InvalidArgumentException; //导入依赖的package包/类
/**
 * set the Q-value parameter
 * @param qValue float to set
 */
public void setQValue(float qValue) throws InvalidArgumentException {
    if (qValue != -1 && (qValue < 0 || qValue > 1))
        throw new InvalidArgumentException(
            "JAIN-SIP Exception, Contact, setQValue(), "
                + "the qValue is not between 0 and 1");
    this.parameters.set(Q, Float.valueOf(qValue));
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:12,代码来源:Contact.java


注:本文中的javax.sip.InvalidArgumentException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。