diff options
author | Frankie B <git@diskfloppy.me> | 2024-05-10 01:12:35 +0100 |
---|---|---|
committer | Frankie B <git@diskfloppy.me> | 2024-05-10 01:12:35 +0100 |
commit | d73fb78686e827360d90d91483e17c9ebd04e462 (patch) | |
tree | 08a85cf2d44c1f24dbcc78a04dda9cb9c5c9a378 /src/com/wilko/jaim/FLAPFrame.java | |
parent | 2e40faff341fb11f4819c019f046d131529ac4e6 (diff) |
Implement remaining client commands, organize into packages
Diffstat (limited to 'src/com/wilko/jaim/FLAPFrame.java')
-rw-r--r-- | src/com/wilko/jaim/FLAPFrame.java | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/src/com/wilko/jaim/FLAPFrame.java b/src/com/wilko/jaim/FLAPFrame.java deleted file mode 100644 index bef422d..0000000 --- a/src/com/wilko/jaim/FLAPFrame.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * (C) 2002 Paul Wilkinson wilko@users.sourceforge.net - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -/* - * FLAPFrame.java - * - * Created on 3 May 2002, 14:51 - */ - -package com.wilko.jaim; - -/** - * @author paulw - * @version $Revision: 1.4 $ - */ -public abstract class FLAPFrame { - - public static final int FLAP_FRAME_SIGNON = 1; - public static final int FLAP_FRAME_DATA = 2; - public static final int FLAP_FRAME_ERROR = 3; - public static final int FLAP_FRAME_SIGNOFF = 4; - public static final int FLAP_FRAME_KEEP_ALIVE = 5; - public static final int FLAP_DATA_OFFSET = 6; - - protected byte[] frame; - protected int fLen; - - /** - * Creates new FLAPFrame - */ - public FLAPFrame() { - initialise(); - } - - protected void initialise() { - frame = new byte[8192]; - frame[0] = (byte) '*'; - frame[1] = 0; - frame[2] = 0; - frame[3] = 0; - frame[4] = 0; - frame[5] = 0; - fLen = 6; - - } - - public int getSequence() { - return ((frame[2] & 0xff) * 256 + (frame[3] & 0xff)); - } - - public void setSequence(int sequence) { - frame[2] = (byte) ((sequence / 256) & 0xff); - frame[3] = (byte) (sequence & 0xff); - } - - public int getLength() { - return ((frame[4] & 0xff) * 256 + (frame[5] & 0xff)); - } - - public void setLength(int length) { - frame[4] = (byte) (length / 256); - frame[5] = (byte) (length & 0xff); - fLen = length + FLAP_DATA_OFFSET; - } - - public byte[] getFrameData() { - byte[] b = new byte[fLen]; - System.arraycopy(frame, 0, b, 0, fLen); - return (b); - } - - protected void setFrameData(byte[] b) { - frame = new byte[b.length]; - fLen = b.length; - System.arraycopy(b, 0, frame, 0, b.length); - } - - public String toString() { - StringBuffer temp = new StringBuffer(); - for (int i = 0; i < fLen; i++) { - int k = frame[i] & 0xff; - if (k < 16) { - temp.append("0" + Integer.toHexString(k) + " "); - } else { - temp.append(Integer.toHexString(k) + " "); - } - } - return (temp.toString()); - } - - public abstract int getFLAPFrameType(); - -} |