// 
// Decompiled by Procyon v0.6.0
// 

package org.jline.terminal.impl.jansi.win;

import java.io.IOException;
import org.fusesource.jansi.internal.Kernel32;
import org.jline.terminal.impl.AbstractWindowsConsoleWriter;

class JansiWinConsoleWriter extends AbstractWindowsConsoleWriter
{
    private final long console;
    private final int[] writtenChars;
    
    public JansiWinConsoleWriter(final long console) {
        this.writtenChars = new int[1];
        this.console = console;
    }
    
    @Override
    protected void writeConsole(final char[] text, final int len) throws IOException {
        if (Kernel32.WriteConsoleW(this.console, text, len, this.writtenChars, 0L) == 0) {
            throw new IOException("Failed to write to console: " + WindowsSupport.getLastErrorMessage());
        }
    }
}
