1 /* -------------------------------------------------------------------
2 GeoVISTA Center (Penn State, Dept. of Geography)
3 Java source file for the class GeoData48States
4 Copyright (c), 2002, GeoVISTA Center
5 All Rights Reserved.
6 Original Author: Xiping Dai and Frank Hardisty
7 $Author: xpdai $
8 $Id: AttributeDescriptionFile.java,v 1.3 2003/07/09 19:38:01 xpdai Exp $
9 $Date: 2003/07/09 19:38:01 $
10 Reference: Document no:
11 ___ ___
12 ------------------------------------------------------------------- *
13 */
14
15
16 package edu.psu.geovista.data.geog;
17 import edu.psu.geovista.io.*;
18 import java.io.*;
19 import java.util.*;
20
21 /***
22
23 *
24 */
25 public class AttributeDescriptionFile {
26
27 transient private String[] attributeDescriptions;
28
29 public AttributeDescriptionFile() {
30
31 }
32
33 public AttributeDescriptionFile(String fileName) throws IOException{
34
35 File tryIt = new File(fileName);
36 boolean exists = tryIt.exists();
37 if (!exists){
38 this.attributeDescriptions = null;
39 return;
40 }
41
42 try {
43 FileIO fio = new FileIO(fileName,"r");
44 Vector desc = new Vector();
45
46 while(!fio.hasReachedEOF()){
47 String line = fio.readLine();
48 if (line != null){//the line after the last line is always null, but we don't want to read it.
49 desc.add(line);
50 }
51 }
52 desc.trimToSize();
53 int len = desc.size();
54 this.attributeDescriptions = new String[len];
55 for (int i = 0; i < len; i ++){
56 this.attributeDescriptions[i] = (String)desc.get(i);
57 }
58 }
59 //catch (IOException ex) {
60 catch (FileNotFoundException ex) {
61 ex.printStackTrace();
62 }
63 }
64 public String[] getAttributeDescriptions() {
65 return attributeDescriptions;
66 }
67 public void setAttributeDescriptions(String[] attributeDescriptions) {
68 this.attributeDescriptions = attributeDescriptions;
69 }
70
71
72 }
This page was automatically generated by Maven