/* 9P Protocol JAVA
 * P9P/type/long9P.java
 * Autor: Jaime Garzon (2006) jgarzon@gmail.com
 *
 * Esta clase es una implementacion del tipo de dato
 * unsigned-long, 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 long9P extends type9P {

   public long value;
   private int sz=8;

   /* CONSTRUCTORES */

   public long9P (byte[] b, int i) { read(b,i); };
   public long9P (long i) { value=i; };
   public long9P() {};


   /* METODOS */

   public void read(byte[] b, int i) {
      value = 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+" ";
   }
}