rt/vm/src/test/java/org/apidesign/vm4brwsr/VMinVM.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 26 Feb 2013 16:54:16 +0100
changeset 772 d382dacfd73f
parent 170 vm/src/test/java/org/apidesign/vm4brwsr/VMinVM.java@2336c52d3ee5
child 869 151f4ccd7673
permissions -rw-r--r--
Moving modules around so the runtime is under one master pom and can be built without building other modules that are in the repository
jaroslav@170
     1
/**
jaroslav@170
     2
 * Back 2 Browser Bytecode Translator
jaroslav@170
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@170
     4
 *
jaroslav@170
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@170
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@170
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@170
     8
 *
jaroslav@170
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@170
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@170
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@170
    12
 * GNU General Public License for more details.
jaroslav@170
    13
 *
jaroslav@170
    14
 * You should have received a copy of the GNU General Public License
jaroslav@170
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@170
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@170
    17
 */
jaroslav@170
    18
package org.apidesign.vm4brwsr;
jaroslav@170
    19
jaroslav@170
    20
import java.io.ByteArrayInputStream;
jaroslav@170
    21
import java.io.IOException;
jaroslav@170
    22
jaroslav@170
    23
/**
jaroslav@170
    24
 *
jaroslav@170
    25
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@170
    26
 */
jaroslav@170
    27
class VMinVM extends ByteCodeToJavaScript {
jaroslav@170
    28
    private VMinVM(Appendable out) {
jaroslav@170
    29
        super(out);
jaroslav@170
    30
    }
jaroslav@170
    31
    
jaroslav@170
    32
    static String toJavaScript(byte[] is) throws IOException {
jaroslav@170
    33
        StringBuilder sb = new StringBuilder();
jaroslav@170
    34
        new VMinVM(sb).compile(new ByteArrayInputStream(is));
jaroslav@170
    35
        return sb.toString().toString();
jaroslav@170
    36
    }
jaroslav@170
    37
jaroslav@170
    38
    @Override
jaroslav@170
    39
    protected boolean requireReference(String internalClassName) {
jaroslav@170
    40
        return false;
jaroslav@170
    41
    }
jaroslav@170
    42
jaroslav@170
    43
    @Override
jaroslav@170
    44
    protected void requireScript(String resourcePath) {
jaroslav@170
    45
    }
jaroslav@170
    46
}