1 19 20 25 26 27 28 29 30 31 32 package soot.coffi; 33 34 import java.util.Enumeration ; 35 36 46 public class Utf8_Enumeration implements Enumeration { 47 48 51 public int c; 53 private short curindex; 54 private short length; 55 private byte bytes[]; 56 57 61 public Utf8_Enumeration() {} 62 65 public Utf8_Enumeration(byte b[]) { 66 bytes = b; 67 curindex = (short)2; 68 length = (short)(((((int)(bytes[0]))&0xff)<<8) + (((int)(bytes[1]))&0xff) + 2); 69 } 70 73 public void reset(byte b[]) { 74 bytes = b; 75 curindex = (short)2; 76 length = (short)(((((int)(bytes[0]))&0xff)<<8) + (((int)(bytes[1]))&0xff) + 2); 77 } 78 79 80 public boolean hasMoreElements() { 81 if (curindex<length) return true; 82 return false; 83 } 84 85 89 public Object nextElement() { 90 byte b; 91 b = bytes[curindex++]; 92 if ((b&((byte)0x80))==0) { c = b; 94 } else if ((b&((byte)0xe0))==0xc0) { c = ((int)(b&((byte)0x1f)))<<6; 96 b = bytes[curindex++]; 97 c |= (int)(b&((byte)0x3f)); 98 } else { c = ((int)(b&((byte)0x0f)))<<12; 100 b = bytes[curindex++]; 101 c |= ((int)(b&((byte)0x3f)))<<6; 102 b = bytes[curindex++]; 103 c |= (int)(b&((byte)0x3f)); 104 } 105 return this; 106 } 107 } 108 | Popular Tags |