home *** CD-ROM | disk | FTP | other *** search
/ ring.yamanashi.ac.jp/pub/pc/freem/action/ / action.zip / baku100.zip / baku100 / Kernel / Util / DataReader.tonyu < prev    next >
Text File  |  2002-11-28  |  492b  |  37 lines

  1. extends Object;
  2.  
  3. constructor DataReader(rr) {
  4.   r=rr;
  5. }
  6.  
  7. function read() {
  8.   return r.read();
  9. }
  10.  
  11. function readInt() {
  12.   var i;
  13.   i=r.read();
  14.   i=i+r.read()*256;
  15.   i=i+r.read()*65536;
  16.   i=i+r.read()*256*65536;
  17.   return i;
  18. }
  19.  
  20. function readString() {
  21.   var l,s;
  22.   l=readInt();s="";
  23.   while (l>0) {
  24.     s=strcat(s, new String(r.read()) );
  25.     if (eof()) l=0; 
  26.     l-=1;
  27.   }
  28.   return s;
  29. }
  30.  
  31. function eof() {
  32.   return r.eof();
  33. }
  34.  
  35. function close() {
  36.   r.close();
  37. }