1 19 package org.netbeans.modules.xml.core.lib; 20 21 import java.io.*; 22 import java.util.*; 23 24 import org.openide.filesystems.*; 25 import org.openide.filesystems.FileSystem; 26 27 33 public class StreamFileObject extends FileObject { 34 35 36 private static final long serialVersionUID =8966806836211837503L; 37 38 39 private org.openide.filesystems.FileObject[] files; 41 private boolean isRoot; 43 private InputStream peer; 45 private FileSystem fs; 46 47 48 50 51 public StreamFileObject(InputStream in) { 52 this(in, false); 53 } 54 55 public StreamFileObject(InputStream in, boolean isRoot) { 56 this.isRoot = isRoot; 57 peer = in; 58 if (isRoot) { 59 files = new org.openide.filesystems.FileObject[] { 60 new StreamFileObject(in) 61 }; 62 } else { 63 files = new org.openide.filesystems.FileObject[0]; 64 } 65 fs = new StreamFileSystem(this); 66 } 67 68 public org.openide.filesystems.FileObject[] getChildren() { 69 return files; 70 } 71 72 public void removeFileChangeListener(org.openide.filesystems.FileChangeListener fileChangeListener) { 73 } 74 75 public org.openide.filesystems.FileLock lock() throws java.io.IOException { 76 return FileLock.NONE; 77 } 78 79 public java.lang.Object getAttribute(java.lang.String str) { 80 return null; 81 } 82 83 public java.util.Date lastModified() { 84 return new Date(0L); 85 } 86 87 public java.lang.String getExt() { 88 return "InputStream"; } 90 91 public boolean isReadOnly() { 92 return true; 93 } 94 95 public org.openide.filesystems.FileObject createData(java.lang.String str, java.lang.String str1) throws java.io.IOException { 96 return null; 97 } 98 99 public void delete(org.openide.filesystems.FileLock fileLock) throws java.io.IOException { 100 } 101 102 public org.openide.filesystems.FileObject createFolder(java.lang.String str) throws java.io.IOException { 103 return null; 104 } 105 106 public void rename(org.openide.filesystems.FileLock fileLock, java.lang.String str, java.lang.String str2) throws java.io.IOException { 107 } 108 109 public boolean isData() { 110 return isRoot == false; 111 } 112 113 public java.io.OutputStream getOutputStream(org.openide.filesystems.FileLock fileLock) throws java.io.IOException { 114 throw new IOException("r/o"); } 116 117 public java.io.InputStream getInputStream() throws java.io.FileNotFoundException { 118 return peer; 119 } 120 121 public boolean isValid() { 122 return true; 123 } 124 125 public java.util.Enumeration getAttributes() { 126 return org.openide.util.Enumerations.empty(); 127 } 128 129 public java.lang.String getName() { 130 return "StreamFileObject"; } 132 133 public void setImportant(boolean param) { 134 } 135 136 public boolean isFolder() { 137 return isRoot; 138 } 139 140 public void setAttribute(java.lang.String str, java.lang.Object obj) throws java.io.IOException { 141 } 142 143 public void addFileChangeListener(org.openide.filesystems.FileChangeListener fileChangeListener) { 144 } 145 146 public long getSize() { 147 return 766; } 149 150 public org.openide.filesystems.FileObject getParent() { 151 if (isRoot) return null; 152 return fs.getRoot(); 153 } 154 155 public boolean isRoot() { 156 return isRoot; 157 } 158 159 public org.openide.filesystems.FileObject getFileObject(java.lang.String str, java.lang.String str1) { 160 return null; 161 } 162 163 public org.openide.filesystems.FileSystem getFileSystem() throws org.openide.filesystems.FileStateInvalidException { 164 return fs; 165 } 166 167 } 168 | Popular Tags |