Java 类net.minecraft.util.io.netty.buffer.ByteBufOutputStream 实例源码

项目:CraftBukkit    文件:MinecraftServer.java   
private void a(ServerPing serverping) {
    File file1 = this.d("server-icon.png");

    if (file1.isFile()) {
        ByteBuf bytebuf = Unpooled.buffer();

        try {
            BufferedImage bufferedimage = ImageIO.read(file1);

            Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
            Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
            ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
            ByteBuf bytebuf1 = Base64.encode(bytebuf);

            serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
        } catch (Exception exception) {
            i.error("Couldn\'t load server icon", exception);
        } finally {
            bytebuf.release();
        }
    }
}
项目:Tweakkit-Server    文件:MinecraftServer.java   
private void a(ServerPing serverping) {
    File file1 = this.d("server-icon.png");

    if (file1.isFile()) {
        ByteBuf bytebuf = Unpooled.buffer();

        try {
            BufferedImage bufferedimage = ImageIO.read(file1);

            Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
            Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
            ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
            ByteBuf bytebuf1 = Base64.encode(bytebuf);

            serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
        } catch (Exception exception) {
            i.error("Couldn\'t load server icon", exception);
        } finally {
            bytebuf.release();
        }
    }
}
项目:DiffUtils    文件:CraftServer_1710.java   
static CraftIconCache loadServerIcon0(BufferedImage image) throws Exception {
    ByteBuf bytebuf = Unpooled.buffer();

    Validate.isTrue(image.getWidth() == 64, "Must be 64 pixels wide");
    Validate.isTrue(image.getHeight() == 64, "Must be 64 pixels high");
    ImageIO.write(image, "PNG", new ByteBufOutputStream(bytebuf));
    ByteBuf bytebuf1 = Base64.encode(bytebuf);

    return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
}
项目:CraftBukkit    文件:CraftServer.java   
static CraftIconCache loadServerIcon0(BufferedImage image) throws Exception {
    ByteBuf bytebuf = Unpooled.buffer();

    Validate.isTrue(image.getWidth() == 64, "Must be 64 pixels wide");
    Validate.isTrue(image.getHeight() == 64, "Must be 64 pixels high");
    ImageIO.write(image, "PNG", new ByteBufOutputStream(bytebuf));
    ByteBuf bytebuf1 = Base64.encode(bytebuf);

    return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
}
项目:Tweakkit-Server    文件:CraftServer.java   
static CraftIconCache loadServerIcon0(BufferedImage image) throws Exception {
    ByteBuf bytebuf = Unpooled.buffer();

    Validate.isTrue(image.getWidth() == 64, "Must be 64 pixels wide");
    Validate.isTrue(image.getHeight() == 64, "Must be 64 pixels high");
    ImageIO.write(image, "PNG", new ByteBufOutputStream(bytebuf));
    ByteBuf bytebuf1 = Base64.encode(bytebuf);

    return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
}