Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libGPE-KML / src-test / org / gvsig / gpe / kml / parser / v21 / kmz / KMZv21BaseTest.java @ 37959

History | View | Annotate | Download (2.76 KB)

1
package org.gvsig.gpe.kml.parser.v21.kmz;
2

    
3
import java.io.BufferedInputStream;
4
import java.io.BufferedReader;
5
import java.io.FileInputStream;
6
import java.io.InputStream;
7
import java.io.InputStreamReader;
8
import java.io.StringReader;
9
import java.util.zip.ZipEntry;
10
import java.util.zip.ZipFile;
11
import java.util.zip.ZipInputStream;
12

    
13
import org.gvsig.gpe.kml.parser.v21.kml.KMLBaseTest;
14

    
15
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
16
 *
17
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
18
 *
19
 * This program is free software; you can redistribute it and/or
20
 * modify it under the terms of the GNU General Public License
21
 * as published by the Free Software Foundation; either version 2
22
 * of the License, or (at your option) any later version.
23
 *
24
 * This program is distributed in the hope that it will be useful,
25
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27
 * GNU General Public License for more details.
28
 *
29
 * You should have received a copy of the GNU General Public License
30
 * along with this program; if not, write to the Free Software
31
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
32
 *
33
 * For more information, contact:
34
 *
35
 *  Generalitat Valenciana
36
 *   Conselleria d'Infraestructures i Transport
37
 *   Av. Blasco Ib??ez, 50
38
 *   46010 VALENCIA
39
 *   SPAIN
40
 *
41
 *      +34 963862235
42
 *   gvsig@gva.es
43
 *      www.gvsig.gva.es
44
 *
45
 *    or
46
 *
47
 *   IVER T.I. S.A
48
 *   Salamanca 50
49
 *   46005 Valencia
50
 *   Spain
51
 *
52
 *   +34 963163400
53
 *   dac@iver.es
54
 */
55
/* CVS MESSAGES:
56
 *
57
 * $Id$
58
 * $Log$
59
 *
60
 */
61
/**
62
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
63
 */
64
public abstract class KMZv21BaseTest extends KMLBaseTest{
65

    
66
        /* (non-Javadoc)
67
         * @see org.gvsig.gpe.readers.GPEReaderBaseTest#getInputStream()
68
         */
69
        public InputStream getInputStream() throws Exception {
70
                FileInputStream fis = new FileInputStream(getFile());
71
                ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
72
                ZipEntry entry = null;
73
                while((entry = zis.getNextEntry()) != null){
74
                        if (!entry.isDirectory()){
75
                                ZipFile fz = new ZipFile(getFile());
76
                                // En ArcMap parece que usan otro m?todo de compresi?n NO compatible con ZipFile!!!
77
                                // Probando:
78
                                InputStream st = fz.getInputStream(entry);
79
                                
80
                                BufferedReader reader = new BufferedReader(new InputStreamReader(st));
81
                                System.out.println(reader.readLine());
82
                                return fz.getInputStream(entry);
83
                        }
84
                }
85
                throw new Exception();
86
        }
87
        
88
        /*
89
         * (non-Javadoc)
90
         * @see org.gvsig.gpe.writers.GPEWriterBaseTest#getGPEParserClass()
91
         */
92
        public Class getGPEParserClass() {
93
                return org.gvsig.gpe.kml.parser.GPEKmz2_1_Parser.class;
94
        }
95

    
96
}