dew/src/main/java/org/apidesign/bck2brwsr/dew/ClassLoaderJavaFileObject.java
changeset 1372 cc58b30499e5
parent 1371 fd2d4ca28bd3
child 1373 c4e57ec5f0df
     1.1 --- a/dew/src/main/java/org/apidesign/bck2brwsr/dew/ClassLoaderJavaFileObject.java	Sat Oct 12 09:05:08 2013 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,91 +0,0 @@
     1.4 -/**
     1.5 - * Back 2 Browser Bytecode Translator
     1.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     1.7 - *
     1.8 - * This program is free software: you can redistribute it and/or modify
     1.9 - * it under the terms of the GNU General Public License as published by
    1.10 - * the Free Software Foundation, version 2 of the License.
    1.11 - *
    1.12 - * This program is distributed in the hope that it will be useful,
    1.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.15 - * GNU General Public License for more details.
    1.16 - *
    1.17 - * You should have received a copy of the GNU General Public License
    1.18 - * along with this program. Look for COPYING file in the top folder.
    1.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    1.20 - */
    1.21 -
    1.22 -package org.apidesign.bck2brwsr.dew;
    1.23 -
    1.24 -import java.io.BufferedReader;
    1.25 -import java.io.FileNotFoundException;
    1.26 -import java.io.IOException;
    1.27 -import java.io.InputStream;
    1.28 -import java.io.InputStreamReader;
    1.29 -import java.io.OutputStream;
    1.30 -import java.io.OutputStreamWriter;
    1.31 -import java.io.Reader;
    1.32 -import java.io.Writer;
    1.33 -
    1.34 -/**
    1.35 - *
    1.36 - * @author Tomas Zezula
    1.37 - */
    1.38 -class ClassLoaderJavaFileObject extends BaseFileObject {
    1.39 -
    1.40 -    ClassLoaderJavaFileObject(final String path) {
    1.41 -        super(path, getKind(path));
    1.42 -    }    
    1.43 -
    1.44 -    @Override
    1.45 -    public InputStream openInputStream() throws IOException {
    1.46 -        final InputStream in = getClass().getClassLoader().getResourceAsStream(path.substring(1));
    1.47 -        if (in == null) {
    1.48 -            throw new FileNotFoundException(path);
    1.49 -        }
    1.50 -        return in;
    1.51 -    }
    1.52 -
    1.53 -    @Override
    1.54 -    public OutputStream openOutputStream() throws IOException {
    1.55 -        throw new UnsupportedOperationException("Read Only FileObject");    //NOI18N
    1.56 -    }
    1.57 -
    1.58 -    @Override
    1.59 -    public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
    1.60 -        return new InputStreamReader(openInputStream());
    1.61 -    }
    1.62 -
    1.63 -    @Override
    1.64 -    public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
    1.65 -        final BufferedReader in = new BufferedReader(openReader(ignoreEncodingErrors));
    1.66 -        try {
    1.67 -            final StringBuilder sb = new StringBuilder();
    1.68 -            String line;
    1.69 -            while ((line = in.readLine()) != null) {
    1.70 -                sb.append(line);
    1.71 -                sb.append('\n');    //NOI18N
    1.72 -            }
    1.73 -            return sb.toString();
    1.74 -        } finally {
    1.75 -            in.close();
    1.76 -        }
    1.77 -    }
    1.78 -
    1.79 -    @Override
    1.80 -    public Writer openWriter() throws IOException {
    1.81 -        return new OutputStreamWriter(openOutputStream());
    1.82 -    }
    1.83 -
    1.84 -    @Override
    1.85 -    public long getLastModified() {
    1.86 -        return System.currentTimeMillis();
    1.87 -    }
    1.88 -
    1.89 -    @Override
    1.90 -    public boolean delete() {
    1.91 -        return false;
    1.92 -    }
    1.93 -
    1.94 -}