PageRenderTime 35ms CodeModel.GetById 26ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/protocols/smpp/src/main/java/org/mobicents/protocols/smpp/gsm/UserData.java

http://mobicents.googlecode.com/
Java | 80 lines | 9 code | 8 blank | 63 comment | 0 complexity | 661fb1e8adeaee1ee57ad8b19b4c7de1 MD5 | raw file
 1/*
 2 * JBoss, Home of Professional Open Source
 3 * Copyright 2011, Red Hat, Inc. and individual contributors
 4 * by the @authors tag. See the copyright.txt in the distribution for a
 5 * full listing of individual contributors.
 6 *
 7 * This is free software; you can redistribute it and/or modify it
 8 * under the terms of the GNU Lesser General Public License as
 9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */
22
23package org.mobicents.protocols.smpp.gsm;
24
25
26/**
27 * Interface for objects that can represent TP-User-Data as defined
28 * by 3GPP TS 23.040.
29 * 
30 * <p>
31 * <strong>Experimental API</strong>: <tt>UserData</tt> and its supporting
32 * classes and implementations are an experimental API and can change or
33 * be removed at any time.
34 * </p>
35 * @version $Id: UserData.java 484 2010-02-08 16:08:50Z orank $
36 */
37public interface UserData {
38    /**
39     * Add a {@link HeaderElement} to this user data implementation.
40     * @param element The header element to add.
41     */
42    void addHeaderElement(HeaderElement element);
43    
44    /**
45     * Calculate if this user data requires multiple SMS segments.
46     * @return <tt>true</tt> if the user data requires multiple SMS
47     * segments, <tt>false</tt> if the data requires only a single SMS.
48     */
49    boolean isMultiMessage();
50    
51    /**
52     * Get the user data as a single message. This method only returns
53     * normally if {@link #isMultiMessage()} returns <tt>false</tt>.
54     * @return A byte array containing the encoded user data.
55     * @throws IllegalStateException If this user data requires more
56     * than one SMS segment.
57     */
58    byte[] toSingleSms();
59    
60    /**
61     * Get the user data SMS segments.
62     * @return An array of byte arrays, each element contains a single
63     * SMS segment.
64     */
65    byte[][] toSegments();
66    
67    /**
68     * Get the payload of this user data. This is the data that is
69     * included in the message after the user data header has been encoded.
70     * @return The payload of this user data.
71     */
72    byte[] getData();
73    
74    /**
75     * Set the payload of this user data.
76     * @param data The payload of this user data.
77     * @see #getData()
78     */
79    void setData(byte[] data);
80}