Code example for SessionOutputBuffer

Methods: writewriteLine

0
    protected void flushCacheWithAppend(byte bufferToAppend[], int off, int len) throws IOException { 
        this.out.writeLine(Integer.toHexString(this.cachePosition + len)); 
        this.out.write(this.cache, 0, this.cachePosition); 
        this.out.write(bufferToAppend, off, len); 
        this.out.writeLine(""); 
        this.cachePosition = 0; 
    } 
 
    protected void writeClosingChunk() throws IOException { 
        // Write the final chunk. 
        this.out.writeLine("0"); 
        this.out.writeLine(""); 
    } 
 
    // ----------------------------------------------------------- Public Methods 
    /** 
     * Must be called to ensure the internal cache is flushed and the closing 
     * chunk is written. 
     * @throws IOException in case of an I/O error 
     */ 
    public void finish() throws IOException { 
        if (!this.wroteLastChunk) { 
            flushCache(); 
            writeClosingChunk(); 
            this.wroteLastChunk = true; 
        } 
    } 
 
    // -------------------------------------------- OutputStream Methods 
    public void write(int b) throws IOException { 
        if (this.closed) { 
            throw new IOException("Attempted write to closed stream."); 
        } 
Experience pair programming with AI  Get Codota for Java