---
# System prepended metadata

title: ReadRSS0(doing)
tags: [Java]

---

###### tags: `Java`

# ReadRSS0(doing)
```java=
/**
 * 
 */
package easywords;

import java.io.*;
import java.net.*;

/**
 * @author b1018015 Ryuku Hisasue
 *
 */
public class ReadRSS0 {
	
	private String address;
	
	public ReadRSS0(String url) {
		address = url;
	}
	
	public String getAddress() {
		return address;
	}
	
	public void reader() throws Exception { 
		URL u = new URL(this.getAddress());
		InputStream is = u.openStream();
		int i = is.read();
		while(i != -1) {
			char c = (char) i;
			System.out.print(c);
			i = is.read();
		}
	}
	public static void main(String[] args) throws Exception {
		ReadRSS0 r = new ReadRSS0("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/health/rss.xml");
		try {
		    r.reader();
		} catch (IOException e) {
		    System.out.println("入出力エラー");
		}
	}

}

```



# ReadRSS1
```java=
/**
 * 
 */
package easywords1;

import java.io.*;
import java.net.*;

/**
 * @author b1018015 Ryuku Hisasue
 *
 */
public class ReadRSS1 {
	
	private String address;
	
	public ReadRSS1(String url) {
		address = url;
	}
	
	public String getAddress() {
		return address;
	}
	
	public void reader() throws IOException { 
		URL u = new URL(this.getAddress());
		InputStream is = u.openStream();
		InputStreamReader isr = new InputStreamReader(is, "UTF8");
		BufferedReader br = new BufferedReader(isr);
		String line = null;
			
		while((line = br.readLine()) != null) {
			line = line.trim().toLowerCase();
			if (line.startsWith("<description>")){
				line = line.replaceAll("<description><!\\[cdata\\[", "");
				line = line.replaceAll("\\]\\]></description>", "");
				String[] word = line.split("[<> ,/\\?\\]\\[\\.\"]+");
				for (String output : word) {
					System.out.print("(" + output + ")");
				}
				System.out.println("");
			}
		}
		br.close();
	}
	public static void main(String[] args)  {
		ReadRSS1 r = new ReadRSS1("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/health/rss.xml");
		try {
		    r.reader();
		} catch (IOException e) {
		    System.out.println("入出力エラー");
		}
	}

}

```