jaroslav@170: /** jaroslav@170: * Back 2 Browser Bytecode Translator jaroslav@170: * Copyright (C) 2012 Jaroslav Tulach jaroslav@170: * jaroslav@170: * This program is free software: you can redistribute it and/or modify jaroslav@170: * it under the terms of the GNU General Public License as published by jaroslav@170: * the Free Software Foundation, version 2 of the License. jaroslav@170: * jaroslav@170: * This program is distributed in the hope that it will be useful, jaroslav@170: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@170: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@170: * GNU General Public License for more details. jaroslav@170: * jaroslav@170: * You should have received a copy of the GNU General Public License jaroslav@170: * along with this program. Look for COPYING file in the top folder. jaroslav@170: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@170: */ jaroslav@170: package org.apidesign.vm4brwsr; jaroslav@170: jaroslav@170: import java.io.ByteArrayInputStream; jaroslav@170: import java.io.IOException; jaroslav@170: jaroslav@170: /** jaroslav@170: * jaroslav@170: * @author Jaroslav Tulach jaroslav@170: */ jaroslav@170: class VMinVM extends ByteCodeToJavaScript { jaroslav@170: private VMinVM(Appendable out) { jaroslav@170: super(out); jaroslav@170: } jaroslav@170: jaroslav@170: static String toJavaScript(byte[] is) throws IOException { jaroslav@170: StringBuilder sb = new StringBuilder(); jaroslav@170: new VMinVM(sb).compile(new ByteArrayInputStream(is)); jaroslav@170: return sb.toString().toString(); jaroslav@170: } jaroslav@170: jaroslav@170: @Override jaroslav@170: protected boolean requireReference(String internalClassName) { jaroslav@170: return false; jaroslav@170: } jaroslav@170: jaroslav@170: @Override jaroslav@170: protected void requireScript(String resourcePath) { jaroslav@170: } jaroslav@170: }