01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package javax.wireless.messaging;
28:
29: /**
30: * An interface representing a binary message. This is a subinterface of
31: * {@link Message Message} which contains methods to get and set the
32: * binary data payload. The <code>setPayloadData()</code>
33: * method sets the value of the payload in the
34: * data container without any checking whether the value
35: * is valid in any way. Methods for manipulating the address portion of
36: * the message are inherited from <code>Message</code>.
37: *
38: * <p>Object instances implementing this interface are just
39: * containers for the data that is passed in.
40: * </p>
41: */
42:
43: public interface BinaryMessage extends Message {
44:
45: /**
46: * Returns the message payload data as an array
47: * of bytes.
48: *
49: * <p>Returns <code>null</code>, if the payload for the message
50: * is not set.
51: * </p>
52: * <p>The returned byte array is a reference to the
53: * byte array of this message and the same reference
54: * is returned for all calls to this method made before the
55: * next call to <code>setPayloadData</code>.
56: *
57: * @return the payload data of this message or
58: * <code>null</code> if the data has not been set
59: * @see #setPayloadData
60: */
61: public byte[] getPayloadData();
62:
63: /**
64: * Sets the payload data of this message. The payload may
65: * be set to <code>null</code>.
66: * <p>Setting the payload using this method only sets the
67: * reference to the byte array. Changes made to the contents
68: * of the byte array subsequently affect the contents of this
69: * <code>BinaryMessage</code> object. Therefore, applications
70: * should not reuse this byte array before the message is sent and the
71: * <code>MessageConnection.send</code> method returns.
72: * </p>
73: * @param data payload data as a byte array
74: * @see #getPayloadData
75: */
76: public void setPayloadData(byte[] data);
77:
78: }
|