KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > catalog > lib > StreamEnvironment


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.xml.catalog.lib;
20
21 import java.io.*;
22 import java.util.*;
23
24 import org.openide.text.*;
25
26 /**
27  * Defines numb InputStream environment but finding CloneableOpenSupport (outerclass).
28  * It hardcodes <code>text/xml</code> MIME type.
29  *
30  * @author Petr Kuzel
31  * @version
32  * @deprecated in favour of URLEnvironment. It can reopen the stream.
33  */

34 public abstract class StreamEnvironment implements CloneableEditorSupport.Env {
35
36     /** Serial Version UID */
37     private static final long serialVersionUID =9098951539895727443L;
38
39     private InputStream peer;
40     
41     private final Date modified;
42
43     
44     /** Creates new StreamEnvironment */
45     public StreamEnvironment(InputStream in) {
46         if (in == null) throw new NullPointerException JavaDoc();
47         peer = in;
48         modified = new Date();
49     }
50     
51     public void markModified() throws java.io.IOException JavaDoc {
52         throw new IOException("r/o"); // NOI18N
53
}
54     
55     public void unmarkModified() {
56     }
57
58     public void removePropertyChangeListener(java.beans.PropertyChangeListener JavaDoc propertyChangeListener) {
59     }
60     
61     public boolean isModified() {
62         return false;
63     }
64     
65     public java.util.Date JavaDoc getTime() {
66         return modified;
67     }
68     
69     public void removeVetoableChangeListener(java.beans.VetoableChangeListener JavaDoc vetoableChangeListener) {
70     }
71     
72     public boolean isValid() {
73         return true;
74     }
75     
76     public java.io.OutputStream JavaDoc outputStream() throws java.io.IOException JavaDoc {
77         throw new IOException("r/o"); // NOI18N
78
}
79
80     /**
81      * @return "text/xml"
82      */

83     public java.lang.String JavaDoc getMimeType() {
84         return "text/xml"; // NOI18N
85
}
86     
87     public java.io.InputStream JavaDoc inputStream() throws java.io.IOException JavaDoc {
88         return peer;
89     }
90     
91     public void addVetoableChangeListener(java.beans.VetoableChangeListener JavaDoc vetoableChangeListener) {
92     }
93     
94     public void addPropertyChangeListener(java.beans.PropertyChangeListener JavaDoc propertyChangeListener) {
95     }
96             
97 }
98
Popular Tags