public static final String readText(InputStream in) throws IOException { return readText(in, null); } public static final List<String> readLines(String s) throws IOException {
public static final String[] readLinesArray(String s) throws IOException { List<String> v=readLines(s); String ret[]=new String[v.size()]; int i=0; for (String line : v) { ret[i++]=line; } return ret; } }
@Override public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return ReadText.readText(url); }
public static final String[] readLinesArray(String s) throws IOException { List<String> v=readLines(s); String ret[]=new String[v.size()]; int i=0; for (String line : v) { ret[i++]=line; } return ret; } }
public static final String readText(InputStream in) throws IOException { return readText(in, null); } public static final List<String> readLines(String s) throws IOException {
public static final List<String> readLines(String s) throws IOException { return readLines(new FileReader(s)); } public static final List<String> readLines(URL u) throws IOException {
@Override public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return ReadText.readText(url); }
public static final List<String> readLines(String s) throws IOException { return readLines(new FileReader(s)); } public static final List<String> readLines(URL u) throws IOException {
public String generateMavenProjectModel(String groupId, String artifactId, String version) throws IOException { String res = "com/ochafik/lang/jnaerator/" + name() + "-pom.xml"; String pom = ReadText.readText(getClass().getClassLoader().getResource(res)); if (pom == null) { throw new FileNotFoundException(res); } pom = pom. replaceAll("%groupId%", groupId). replaceAll("%artifactId%", artifactId). replaceAll("%version%", version); return pom; } }
public static final List<String> readLines(InputStream in) throws IOException { if (in == null) return null; List<String> r = readLines(new InputStreamReader(in)); in.close(); return r; } public static final List<String> readLines(Reader r) throws IOException {
boolean load() { if (!persistentFile.exists()) return false; sourceTextArea.setText(ReadText.readText(persistentFile)); return true; } void save() {
public static final List<String> readLines(URL u) throws IOException { InputStream in = u.openStream(); List<String> r = readLines(in); in.close(); return r; } public static final List<String> readLines(InputStream in) throws IOException {
public String generateMavenProjectModel(String groupId, String artifactId, String version) throws IOException { String res = "com/ochafik/lang/jnaerator/" + name() + "-pom.xml"; String pom = ReadText.readText(getClass().getClassLoader().getResource(res)); if (pom == null) { throw new FileNotFoundException(res); } pom = pom. replaceAll("%groupId%", groupId). replaceAll("%artifactId%", artifactId). replaceAll("%version%", version); return pom; } }
public static final List<String> readLines(URL u) throws IOException { InputStream in = u.openStream(); List<String> r = readLines(in); in.close(); return r; } public static final List<String> readLines(InputStream in) throws IOException {
public static final String readText(URL u) throws IOException { if (u == null) return null; String encoding = null; URLConnection con = u.openConnection(); // if (con instanceof HttpsURLConnection) { // ((HttpsURLConnection)con).setHostnameVerifier(new HostnameVerifier() { // public boolean verify(String hostname, SSLSession session) { // return true; // } // }); // } if (con instanceof HttpURLConnection) { String contentType = con.getContentType(); encoding = RegexUtils.findFirst(contentType, charsetPattern, 1); } InputStream in = con.getInputStream(); String text = readText(in, encoding); in.close(); return text; } static Pattern[] embeddedCharsetPatterns = new Pattern[] {
public static final List<String> readLines(InputStream in) throws IOException { if (in == null) return null; List<String> r = readLines(new InputStreamReader(in)); in.close(); return r; } public static final List<String> readLines(Reader r) throws IOException {
public static final String readText(URL u) throws IOException { if (u == null) return null; String encoding = null; URLConnection con = u.openConnection(); // if (con instanceof HttpsURLConnection) { // ((HttpsURLConnection)con).setHostnameVerifier(new HostnameVerifier() { // public boolean verify(String hostname, SSLSession session) { // return true; // } // }); // } if (con instanceof HttpURLConnection) { String contentType = con.getContentType(); encoding = RegexUtils.findFirst(contentType, charsetPattern, 1); } InputStream in = con.getInputStream(); String text = readText(in, encoding); in.close(); return text; } static Pattern[] embeddedCharsetPatterns = new Pattern[] {
public static Set<String> getForcedProtocolParents(String protocolName) { if (protocolsForcedInheritance == null) { protocolsForcedInheritance = new LinkedHashMap<String, Set<String>>(); try { InputStream in = ObjectiveCGenerator.class.getClassLoader().getResourceAsStream("com/ochafik/lang/jnaerator/ObjectiveCProtocolsForcedInheritanceList.data"); List<String> lines = ReadText.readLines(in); for (String line : lines) { line = line.trim(); if (line.startsWith("//") || line.startsWith("#") || line.length() == 0) { continue; } String[] tks = line.split(":"); protocolsForcedInheritance.put(tks[0], new TreeSet<String>(Arrays.asList(tks[1].split(",")))); } } catch (IOException ex) { ex.printStackTrace(); } } Set<String> ret = protocolsForcedInheritance.get(protocolName); return ret == null ? Collections.EMPTY_SET : ret; } static Map<String, Set<String>> methodsExcludedFromStaticForwarding;
@SuppressWarnings("deprecation") public static void main(String args[]) { JFrame f=new JFrame("Test"); String text=args.length==0 ? "" : ReadText.readText(new File(args[0])); JEditTextArea ta=new JEditTextArea(); ta.setText(text); f.getContentPane().add("Center",new JScrollPane(ta)); f.pack(); f.show(); } }
public static Set<String> getForcedProtocolParents(String protocolName) { if (protocolsForcedInheritance == null) { protocolsForcedInheritance = new LinkedHashMap<String, Set<String>>(); try { InputStream in = ObjectiveCGenerator.class.getClassLoader().getResourceAsStream("com/ochafik/lang/jnaerator/ObjectiveCProtocolsForcedInheritanceList.data"); List<String> lines = ReadText.readLines(in); for (String line : lines) { line = line.trim(); if (line.startsWith("//") || line.startsWith("#") || line.length() == 0) { continue; } String[] tks = line.split(":"); protocolsForcedInheritance.put(tks[0], new TreeSet<String>(Arrays.asList(tks[1].split(",")))); } } catch (IOException ex) { ex.printStackTrace(); } } Set<String> ret = protocolsForcedInheritance.get(protocolName); return ret == null ? Collections.EMPTY_SET : ret; } static Map<String, Set<String>> methodsExcludedFromStaticForwarding;