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


Java ByteArrayOutputStream.flush方法代码示例

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


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

示例1: getCurrentScreen

import org.apache.commons.io.output.ByteArrayOutputStream; //导入方法依赖的package包/类
public Pair<ProcessingLifecycleStatus, byte[]> getCurrentScreen(final ProcessingLifecycleStatus status, final AssumedScreenTest screenTest) throws ApplicationDownException, IOException {
    if(!processManager.isMtgoRunningOrLoading()) {
        throw new ApplicationDownException("MTGO is not running!");
    }

    BufferedImage bi = robot.createScreenCapture(new Rectangle(0, 0, screenWidth, screenHeight));

    if(bi != null) {
        RawLines rawLines;

        if (screenTest == AssumedScreenTest.NOT_NEEDED) {
            rawLines = tesseractWrapper.getRawText(bi);
        } else {
            rawLines = tesseractWrapper.getRawText(bi, screenTest.getScreenTestBounds());
        }

        logger.info("Processing raw lines");
        final ProcessingLifecycleStatus outcomeStatus = rawLinesProcessor.determineLifecycleStatus(rawLines);
        logger.info("Determined new status: " + status.name());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ImageIO.write(bi, "jpg", baos);
        baos.flush();
        byte[] imageAsByteArray = baos.toByteArray();
        baos.close();

        return new ImmutablePair<>(outcomeStatus, imageAsByteArray);
    }

    throw new ApplicationDownException("Somehow made it to this unreachable point");
}
 
开发者ID:corydissinger,项目名称:mtgo-best-bot,代码行数:32,代码来源:RobotWrapper.java

示例2: createBotCamera

import org.apache.commons.io.output.ByteArrayOutputStream; //导入方法依赖的package包/类
private BotCamera createBotCamera(BufferedImage image, PlayerBot remotePlayerBot) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ImageIO.write(image, "jpg", baos );
    baos.flush();
    byte[] imageInByte = baos.toByteArray();

    BotCamera botCamera = new BotCamera(imageInByte, new Date());
    botCamera.setPlayerBot(remotePlayerBot);
    return botCamera;
}
 
开发者ID:corydissinger,项目名称:mtgo-best-bot,代码行数:11,代码来源:RobotWrapper.java

示例3: writeNiFiPropertiesFile

import org.apache.commons.io.output.ByteArrayOutputStream; //导入方法依赖的package包/类
protected static void writeNiFiPropertiesFile(ByteArrayOutputStream nifiPropertiesOutputStream, String destPath) throws IOException {
    final Path nifiPropertiesPath = Paths.get(destPath, "nifi.properties");
    try (FileOutputStream nifiProperties = new FileOutputStream(nifiPropertiesPath.toString())) {
        nifiPropertiesOutputStream.writeTo(nifiProperties);
    } finally {
        if (nifiPropertiesOutputStream != null) {
            nifiPropertiesOutputStream.flush();
            nifiPropertiesOutputStream.close();
        }
    }
}
 
开发者ID:apache,项目名称:nifi-minifi,代码行数:12,代码来源:ConfigTransformer.java


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