1 15 package net.nutch.parse.msword; 16 17 18 24 public class WordTextBuffer 25 { 26 StringBuffer _buf; 27 boolean _hold; 28 29 public WordTextBuffer() 30 { 31 _buf = new StringBuffer (); 32 _hold = false; 33 } 34 35 public void append(String text) 36 { 37 char[] letters = text.toCharArray(); 38 for (int x = 0; x < letters.length; x++) 39 { 40 switch(letters[x]) 41 { 42 case '\r': 43 _buf.append("\r\n"); 44 break; 45 case 0x13: 46 _hold = true; 47 break; 48 case 0x14: 49 _hold = false; 50 break; 51 default: 52 if (!_hold) 53 { 54 _buf.append(letters[x]); 55 } 56 break; 57 } 58 } 59 } 60 61 public String toString() 62 { 63 return _buf.toString(); 64 } 65 66 } 67 | Popular Tags |