当前位置: 首页>>代码示例>>Java>>正文


Java Shell.setOut方法代码示例

本文整理汇总了Java中org.h2.tools.Shell.setOut方法的典型用法代码示例。如果您正苦于以下问题:Java Shell.setOut方法的具体用法?Java Shell.setOut怎么用?Java Shell.setOut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.h2.tools.Shell的用法示例。


在下文中一共展示了Shell.setOut方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doPost

import org.h2.tools.Shell; //导入方法依赖的package包/类
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.setHeader("Cache-Control", "no-cache, no-store, must-revalidate, private");
    resp.setHeader("Pragma", "no-cache");
    resp.setDateHeader("Expires", 0);
    if (API.allowedBotHosts != null && ! API.allowedBotHosts.contains(req.getRemoteHost())) {
        resp.sendError(HttpServletResponse.SC_FORBIDDEN);
        return;
    }

    String line = Convert.nullToEmpty(req.getParameter("line"));
    try (PrintStream out = new PrintStream(resp.getOutputStream())) {
        out.println("\n> " + line);
        try {
            Shell shell = new Shell();
            shell.setErr(out);
            shell.setOut(out);
            shell.runTool(Db.getConnection(), "-sql", line);
        } catch (SQLException e) {
            out.println(e.toString());
        }
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:24,代码来源:DbShellServlet.java

示例2: doPost

import org.h2.tools.Shell; //导入方法依赖的package包/类
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.setHeader("Cache-Control", "no-cache, no-store, must-revalidate, private");
    resp.setHeader("Pragma", "no-cache");
    resp.setDateHeader("Expires", 0);
    if (API.allowedBotHosts != null && ! API.allowedBotHosts.contains(req.getRemoteHost())) {
        resp.sendError(HttpServletResponse.SC_FORBIDDEN);
        return;
    }

    String line = Convert.nullToEmpty(req.getParameter("line"));
    try (PrintStream out = new PrintStream(resp.getOutputStream())) {
        out.println("\n> " + line);
        try {
            Shell shell = new Shell();
            shell.setErr(out);
            shell.setOut(out);
            shell.runTool(Db.db.getConnection(), "-sql", line);
        } catch (SQLException e) {
            out.println(e.toString());
        }
    }
}
 
开发者ID:risex,项目名称:risecoin,代码行数:24,代码来源:DbShellServlet.java

示例3: executeQuery

import org.h2.tools.Shell; //导入方法依赖的package包/类
public static String executeQuery(String line) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream out = new PrintStream(baos);
    out.println(line);
    try {
        Shell shell = new Shell();
        shell.setErr(out);
        shell.setOut(out);
        shell.runTool(Db.db.getConnection(), "-sql", line);
    } catch (SQLException e) {
        out.println(e.toString());
    }
    return new String(baos.toByteArray());
}
 
开发者ID:BitcoinFullnode,项目名称:ROKOS-OK-Bitcoin-Fullnode,代码行数:15,代码来源:Helper.java


注:本文中的org.h2.tools.Shell.setOut方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。