001package edu.pdx.cs410J.reflect;
002
003import java.io.*;
004import java.net.URL;
005
006/**
007 * This program reads a resource containing the text of the
008 * Declaration of Independence and prints it to standard out.
009 */
010public class PrintDeclaration {
011
012  public static void main(String[] args) {
013    String absoluteName = "/edu/pdx/cs410J/reflect/doi.txt";
014    Class c = PrintDeclaration.class;
015    URL url = c.getResource(absoluteName);
016    System.out.println(url);
017    
018    try {
019      InputStream is = c.getResourceAsStream("doi.txt");
020      BufferedReader br = 
021        new BufferedReader(new InputStreamReader(is));
022      while (br.ready()) {
023        System.out.println(br.readLine());
024      }
025
026    } catch (IOException ex) {
027      ex.printStackTrace(System.err);
028    }
029  }
030
031}