linphone-LinphoneContent.java文件分析

来源:互联网 发布:京东货到付款拒收 知乎 编辑:程序博客网 时间:2024/06/06 07:41

官方说明

/** * LinphoneContent interface describes a SIP message content (body). * It can be used together with the LinphoneInfoMessage, in order to add content attachment to the INFO message. * @author smorlat * */

翻译:Linphonecontent接口描述了一个SIP消息体。他可以和LinphonInfoMessage一起使用,放入INFO消息队列中。

UML类图

LinphoneContent的继承关系

LinphoneContentImpl.java

package org.linphone.core;public class LinphoneContentImpl implements LinphoneContent {    private String mType, mSubtype, mEncoding, mName;    private byte[] mData;    private int mExpectedSize;    public LinphoneContentImpl(String type, String subtype, byte data[], String encoding){        mType = type;        mSubtype = subtype;        mData = data;        mEncoding = encoding;        mName = null;        mExpectedSize = 0;    }    public LinphoneContentImpl(String name, String type, String subtype, byte data[], String encoding, int expectedSize){        mType = type;        mSubtype = subtype;        mData = data;        mEncoding = encoding;        mName = name;        mExpectedSize = expectedSize;    }    //Get the type of the content. for example"application"    @Override    public String getType() {        return mType;    }    // Get the Subtype of the content, for example "html"    @Override    public String getSubtype() {        return mSubtype;    }    // Get the data as a string    @Override    public String getDataAsString() {        if (mData != null)            return new String(mData);        return null;    }    // Get the expected data size    @Override    public void setExpectedSize(int size) {        mExpectedSize = size;    }    // the same as above    @Override    public int getExpectedSize() {        return mExpectedSize;    }    // return the size of the data field    @Override    public int getRealSize() {        if (mData != null)            return mData.length;        return 0;    }    // Set the content type, for example "application"    @Override    public void setType(String type) {        mType = type;    }    //set the subtype, for example "text"    @Override    public void setSubtype(String subtype) {        mSubtype = subtype;    }    @Override    public void setStringData(String data) {        if (data != null)            mData = data.getBytes();        else            mData = null;    }    @Override    public void setData(byte data[]){        mData = data;    }    @Override    public String getEncoding() {        return mEncoding;    }    @Override    public byte[] getData() {        return mData;    }    @Override    public void setEncoding(String encoding) {        mEncoding = encoding;    }    @Override    public void setName(String name) {        mName = name;    }    @Override    public String getName() {        return mName;    }}
0 0
原创粉丝点击