Package gov.nist.javax.sip.header

Examples of gov.nist.javax.sip.header.ContentType


     * @param type is the messge type.
     * @param subType is the message subType.
     * @param messageContent is the message content as a byte array.
     */
    public void setMessageContent(String type, String subType, byte[] messageContent) {
        ContentType ct = new ContentType(type, subType);
        this.setHeader(ct);
        this.setMessageContent(messageContent);

        computeContentLength(messageContent);
    }
View Full Code Here


    /**
     * Returns the charset to use for encoding/decoding the body of this message
     */
    protected final String getCharset() {
        ContentType ct = getContentTypeHeader();
        if (ct!=null) {
            String c = ct.getCharset();
            return c!=null ? c : contentEncodingCharset;
        } else return contentEncodingCharset;
    }
View Full Code Here

   */
  public String getMessageContent() throws UnsupportedEncodingException {
    if (this.messageContent == null && this.messageContentBytes == null)
      return null;
    else if (this.messageContent == null) {
      ContentType contentTypeHeader = getContentTypeHeader();
      if (contentTypeHeader != null) {
        String charset = contentTypeHeader.getCharset();
        if (charset != null) {
          this.messageContent = new String(messageContentBytes,
              charset);
        } else {
          this.messageContent = new String(messageContentBytes,
View Full Code Here

          && this.messageContentObject == null) {
        return null;
      } else if (this.messageContentObject != null) {
        String messageContent = this.messageContentObject.toString();
        byte[] messageContentBytes;
        ContentType contentTypeHeader = getContentTypeHeader();
        if (contentTypeHeader != null) {
          String charset = contentTypeHeader.getCharset();
          if (charset != null) {
            messageContentBytes = messageContent.getBytes(charset);
          } else {
            messageContentBytes = messageContent
                .getBytes(contentEncodingCharset);
          }
        } else
          messageContentBytes = messageContent
              .getBytes(contentEncodingCharset);
        return messageContentBytes;
      } else if (this.messageContent != null) {
        byte[] messageContentBytes;
        ContentType contentTypeHeader = getContentTypeHeader();
        if (contentTypeHeader != null) {
          String charset = contentTypeHeader.getCharset();
          if (charset != null) {
            messageContentBytes = this.messageContent
                .getBytes(charset);
          } else {
            messageContentBytes = this.messageContent
View Full Code Here

   */
  public void setMessageContent(String type, String subType,
      String messageContent) {
    if (messageContent == null)
      throw new IllegalArgumentException("messgeContent is null");
    ContentType ct = new ContentType(type, subType);
    this.setHeader(ct);
    this.messageContent = messageContent;
    this.messageContentBytes = null;
    this.messageContentObject = null;
    // Could be double byte so we need to compute length
View Full Code Here

   * @param messageContent
   *            is the message content as a byte array.
   */
  public void setMessageContent(String type, String subType,
      byte[] messageContent) {
    ContentType ct = new ContentType(type, subType);
    this.setHeader(ct);
    this.setMessageContent(messageContent);

    computeContentLength(messageContent);
  }
View Full Code Here

  private void computeContentLength(Object content) {
    int length = 0;
    if (content != null) {
      if (content instanceof String) {
        String charset = null;
        ContentType contentTypeHeader = getContentTypeHeader();
        if (contentTypeHeader != null) {
          charset = contentTypeHeader.getCharset();
        }
        if (charset == null) {
          charset = contentEncodingCharset;
        }
        try {
View Full Code Here

     * @param messageContent is the messge content as a string.
     */
    public void setMessageContent(String type, String subType, String messageContent) {
        if (messageContent == null)
            throw new IllegalArgumentException("messgeContent is null");
        ContentType ct = new ContentType(type, subType);
        this.setHeader(ct);
        this.messageContent = messageContent;
        this.messageContentBytes = null;
        this.messageContentObject = null;
        // Could be double byte so we need to compute length
View Full Code Here

     * @param type is the messge type.
     * @param subType is the message subType.
     * @param messageContent is the message content as a byte array.
     */
    public void setMessageContent(String type, String subType, byte[] messageContent) {
        ContentType ct = new ContentType(type, subType);
        this.setHeader(ct);
        this.setMessageContent(messageContent);

        computeContentLength(messageContent);
    }
View Full Code Here

    /**
     * Returns the charset to use for encoding/decoding the body of this message
     */
    protected final String getCharset() {
      ContentType ct = getContentTypeHeader();
      if (ct!=null) {
        String c = ct.getCharset();
        return c!=null ? c : contentEncodingCharset;
      } else return contentEncodingCharset;
    }
View Full Code Here

TOP

Related Classes of gov.nist.javax.sip.header.ContentType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.