1 19 20 package org.netbeans.modules.tasklist.providers; 21 22 import org.openide.filesystems.FileObject; 23 import org.openide.ErrorManager; 24 25 import java.io.IOException ; 26 import java.io.InputStreamReader ; 27 import java.io.Reader ; 28 import java.io.BufferedInputStream ; 29 30 35 final class PropertiesSuggestionContext { 36 37 static String getContent(FileObject fo) { 38 try { 39 char[] buf = new char[1024*64]; 40 StringBuffer sb = new StringBuffer (); 41 Reader r = new InputStreamReader (new BufferedInputStream (fo.getInputStream()), "ISO8859-1"); int len; 43 try { 44 while (true) { 45 len = r.read(buf); 46 if (len == -1) break; 47 sb.append(buf, 0, len); 48 } 49 return sb.toString(); 50 } finally { 51 r.close(); 52 } 53 } catch (IOException e) { 54 ErrorManager.getDefault().notify(e); 55 } 56 return null; 57 } 58 59 60 } 61 | Popular Tags |