1 /* 2 * Created on Feb 8, 2005 3 * Created by Alon Rohter 4 * Copyright (C) Azureus Software, Inc, All Rights Reserved. 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 */ 19 20 package com.aelitis.azureus.core.peermanager.messaging.azureus; 21 22 23 import com.aelitis.azureus.core.networkmanager.RawMessage; 24 import com.aelitis.azureus.core.peermanager.messaging.*; 25 26 27 28 /** 29 * 30 * 31 */ 32 33 public class 34 AZMessageEncoder 35 implements 36 MessageStreamEncoder 37 { 38 public static final int PADDING_MODE_NONE = 0; 39 public static final int PADDING_MODE_NORMAL = 1; 40 public static final int PADDING_MODE_MINIMAL = 2; 41 42 private int padding_mode; 43 44 public AZMessageEncoder( int _padding_mode )45 AZMessageEncoder( 46 int _padding_mode ) 47 { 48 padding_mode = _padding_mode; 49 } 50 51 52 encodeMessage( Message message )53 public RawMessage[] encodeMessage( Message message ) { 54 return new RawMessage[]{ AZMessageFactory.createAZRawMessage( message, padding_mode )}; 55 } 56 57 58 } 59