/* 9P Protocol JAVA * P9P/type/byte9P.java * Autor: Jaime Garzon (2006) jgarzon@gmail.com * * Esta clase es una implementacion del tipo de dato * unsigned-byte, usado en el protocolo 9P de Plan9P. * Los metodos Write y Read, permiten escribir el valor * de la forma little-endian en un Buffer o leerlo de un * array de bytes, respectivamente. */ package P9P.type; import java.io.*; public class byte9P extends type9P { public short value; private int sz=1; /* CONSTRUCTORES */ public byte9P (byte[] b, int i) { read(b,i); } public byte9P (short i) { value=i; } public byte9P() { value=0; } /* METODOS */ public void read(byte[] b, int i) { value = (short) convBytearray2Number(sz, b, i); } public void write(ByteArrayOutputStream buf) { buf.write(convNumber2Bytearray(sz,value),0,sz); } public int len() { return sz; } public String toString() { return value+" "; } }