1 /* 2 * Copyright (c) 1998-2002 The Jgroup Team. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License version 2 as 6 * published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU Lesser General Public License for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * 17 */ 18 19 package jgroup.relacs.types; 20 21 import java.io.IOException; 22 import java.io.ObjectInput; 23 import java.io.ObjectOutput; 24 25 /** 26 * The <code>MessageTag</code> class wraps a value of the relacs daemon 27 * and mss type in an object. 28 * 29 * @author Hein Meling 30 * @since Jgroup 1.2 31 */ 32 public final class MessageTag 33 { 34 35 //////////////////////////////////////////////////////////////////////////////////////////// 36 // Constants 37 //////////////////////////////////////////////////////////////////////////////////////////// 38 39 /** Size of this object in bytes */ 40 public static final int SIZE = 1; 41 42 43 //////////////////////////////////////////////////////////////////////////////////////////// 44 // Marshaling / unmarshaling methods 45 //////////////////////////////////////////////////////////////////////////////////////////// 46 47 /** 48 * Marshals the specified message tag to an outgoing message. 49 */ 50 public static void marshal(ObjectOutput msg, byte value) 51 throws IOException 52 { 53 msg.writeByte(value); 54 } 55 56 /** 57 * Unmarshals a message tag from an incoming message. 58 */ 59 public static byte unmarshal(ObjectInput msg) 60 throws IOException 61 { 62 return msg.readByte(); 63 } 64 65 /** 66 * Unmarshals a message tag from a byte. 67 */ 68 public static byte unmarshal(byte value) 69 { 70 return value; 71 } 72 73 } // END Flag