⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmmessage.java

📁 用于开发mms应用的Java库
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	public String getMessageTypeStr() { if (messageType == -1) return null; return MMConstants.MESSAGE_TYPES[messageType]; }

	/**
	 * set X-MMS-Message-Size
	 */
	public void setMessageSize(long size) { this.messageSize = size; }
	
	/**
	 * get X-MMS-Message-Size
	 */
	public long getMessageSize() { return messageSize; }
	
	/**
	 * set X-MMS-Version
	 */
	public void setVersion(int version) { this.version = version; }
	
	/**
	 * Return X-MMS-Version
	 */
	public int getVersion() { return version; }
	
	/**
	 * Return string representation of X-MMS-Version
	 */
	public String getVersionStr() { if (version == -1) return null; return MMDecoder.versionToString(version); }	
	
	/**
	 * Set X-MMS-Priority
	 */
	public void setPriority(int p) { this.priority = p; }
	
	/**
	 * Return X-MMS-Priority
	 */
	public int getPriority() { if (priority == -1) return 0; else return priority; }

	/**
	 * Return string representation of X-MMS-Priority
	 */
	public String getPriorityStr() { if (priority == -1) return null; return MMConstants.PRIORITIES[priority]; }

	/**
	 * Set X-MMS-Read-Reply
	 */
	public void setReadReply(Boolean b) { this.readReply = b; }
	
	/**
	 * Get X-MMS-Read-Reply
	 */
	public boolean getReadReply() { if (readReply == null) return false; return this.readReply.booleanValue(); }

	/**
	 * Set X-MMS-Report-Allowed
	 */
	public void setReportAllowed(Boolean b) { this.reportAllowed = b; }
	
	/**
	 * Get X-MMS-Report-Allowed
	 */
	public boolean getReportAllowed() { if (reportAllowed == null) return false; return this.reportAllowed.booleanValue(); }

	/**
	 * Set X-MMS-Response-Status
	 */
	public void setResponseStatus(int p) { this.responseStatus = p; }
	
	/**
	 * Get X-MMS-Response-Status
	 */
	public int getResponseStatus() { return this.responseStatus; }

	/**
	 * Return string representation of X-MMS-Response-Status
	 */
	public String getResponseStatusStr() { if (responseStatus == -1) return null; return MMConstants.RESPONSE_STATUSES[responseStatus]; }

	/**
	 * Set X-MMS-Response-Text
	 */
	public void setResponseText(String id) { this.responseText = id; }
	
	/**
	 * Get X-MMS-Response-Text
	 */
	public String getResponseText() { return this.responseText; }
	
	/**
	 * Set X-MMS-Sender-Visibility
	 */
	public void setSenderVisibility(Boolean b) { this.senderVisibility = b; }
	
	/**
	 * Get X-MMS-Sender-Visibility
	 */
	public Boolean getSenderVisibility() { return this.senderVisibility; }
	
	/**
	 * Set X-MMS-Status
	 */
	public void setStatus(int p) { this.status = p; }
	
	/**
	 * Get X-MMS-Status
	 */
	public int getStatus() { return this.status; }

	/**
	 * Return string representation of X-MMS-Status
	 */
	public String getStatusStr() { if (status == -1) return null; return MMConstants.STATUSES[status]; }
	
	/**
	 * Set Subject
	 */
	public void setSubject(String s) { this.subject = s; }
	
	/**
	 * Get Subject
	 */
	public String getSubject() { return this.subject; }

	/**
	 * Set To -address. Shortcut for clearTo(), addToAddress(..)
	 */
	public void setTo(String s) { this.to = new ArrayList(); this.to.add(s); }
	
	/**
	 * Return To addresses
	 */
	public ArrayList getTo() { return to; }
	
	/**
	 * Clear all To -recipients
	 */
	public void clearTo() { this.to = null; }
	
	/**
	 * Add a To recipient
	 */
	public void addToAddress(String s) { if (to == null) to = new ArrayList(); to.add(s); }

	/**
	 * Set X-MMS-Transaction-ID
	 */
	public void setTransactionId(String s) { this.transactionId = s; }
	
	/**
	 * Get X-MMS-Transaction-Id
	 */
	public String getTransactionId() { return this.transactionId; }


	/**
	 * check if Content-Location is available (i.e. not null)
	 */	
	public boolean isContentLocationAvailable() { return contentLocation != null; }

	/**
	 * check if Content-Type is available (i.e. not null)
	 */	
	public boolean isContentTypeAvailable() { return contentType != null; }

	/**
	 * check if Date is available
	 */
	public boolean isDateAvailable() { return date != null; }
	
	/**
	 * check if X-MMS-Delivery-Report is available (i.e. not null)
	 */	
	public boolean isDeliveryReportAvailable() { return deliveryReport != null; }
	
	/**
	 * check if X-MMS-Delivery-Time is available (i.e. not null)
	 */
	public boolean isDeliveryTimeAvailable() { return deliveryTime != null; }
	
	/**
	 * check if X-MMS-Expiry is available (i.e. not null)
	 */	
	public boolean isExpiryAvailable() { return expiry != null; }
	
	/**
	 * check if From is available (i.e. not null)
	 */		
	public boolean isFromAvailable() { return from != null; }	
	
	/**
	 * check if X-MMS-Message-Class is available
	 */			
	public boolean isMessageClassAvailable() { return messageClass != -1; }	
	
	/**
	 * check if Message-ID is available
	 */				
	public boolean isMessageIdAvailable() { return messageId != null; }
	
	/**
	 * check if X-MMS-Message-Type is available
	 */					
	public boolean isMessageTypeAvailable() { return messageType != -1; }	
	
	/**
	 * check if X-MMS-Message-Priority is available
	 */						
	public boolean isPriorityAvailable() { return priority != -1; }	
	
	/**
	 * check if X-MMS-Read-Reply is available (i.e. not null)
	 */							
	public boolean isReadReplyAvailable() { return readReply != null; }	
	
	/**
	 * check if X-MMS-Response-Status is available (i.e. not null)
	 */								
	public boolean isResponseStatusAvailable() { return responseStatus != -1; }	
	
	/**
	 * check if X-MMS-Response-Text is available (i.e. not null)
	 */									
	public boolean isResponseTextAvailable() { return responseText != null; }	
	
	/**
	 * check if X-MMS-Sender-Visibility is available (i.e. not null)
	 */										
	public boolean isSenderVisibilityAvailable() { return senderVisibility != null; }	
	
	/**
	 * check if X-MMS-Status is available
	 */											
	public boolean isStatusAvailable() { return status != -1; }	
	
	/**
	 * check if Subject is available (i.e. not null)
	 */												
	public boolean isSubjectAvailable() { return subject != null; }	
	
	/**
	 * check if To is available 
	 */													
	public boolean isToAvailable() { return to != null; }	

	/**
	 * check if Cc is available 
	 */													
	public boolean isCcAvailable() { return cc != null; }	

	/**
	 * check if Bcc is available 
	 */													
	public boolean isBccAvailable() { return bcc != null; }	

	
	/**
	 * check if X-MMS-Transaction-ID is available 
	 */														
	public boolean isTransactionIdAvailable() { return transactionId != null; }	
	
	/**
	 * check if X-MMS-Version is available 
	 */															
	public boolean isVersionAvailable() { return version != -1; }	
	

	/**
	 * Default no-args constructor, create an empty MMMessage
	 */
	public MMMessage() {
		super();
	}
		
	/**
	 * Creates a MMMessage with given message type and transaction id
	 */
	public MMMessage(int messageType, String transactionId) {
		super();
		setMessageType(messageType);
		setTransactionId(transactionId);		
		setVersion(MMConstants.MMS_VERSION_1_0);
	}
		
	/**
	 * Create a string (mime) representation of this message
	 * 
	 * @return String containing a mime encoded message
	 */
	public String toString() {		
		try {		
			return MMEncoder.toString(this);
		} catch (Exception e) {
			e.printStackTrace();	
		}
		return null;
	} 
	
	/**
	 * Encode the message, i.e. create a valid mms encapsulated byte array
	 * 
	 * @return byte[] containing the binary representation of this message
	 * @throws MMEncodingException
	 */
	public byte[] encode() throws MMEncodingException {
		return MMEncoder.encode(this);
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -