Logo Search packages:      
Sourcecode: inkscape version File versions

void org::w3c::dom::io::Base64OutputStream::close (  )  [virtual]

Closes this output stream and releases any system resources associated with this stream.

Reimplemented from org::w3c::dom::io::BasicOutputStream.

Definition at line 218 of file base64stream.cpp.

References org::w3c::dom::io::OutputStream::close(), org::w3c::dom::io::OutputStream::put(), and putCh().

{
    if (closed)
        return;

    //get any last bytes (1 or 2) out of the buffer
    if (bitCount == 16)
        {
        outBuf <<= 2;  //pad to make 18 bits

        int indx  = (int)((outBuf & 0x0003f000L) >> 12);
        int obyte = (int)base64encode[indx & 63];
        putCh(obyte);

        indx      = (int)((outBuf & 0x00000fc0L) >>  6);
        obyte     = (int)base64encode[indx & 63];
        putCh(obyte);

        indx      = (int)((outBuf & 0x0000003fL)      );
        obyte     = (int)base64encode[indx & 63];
        putCh(obyte);

        putCh('=');
        }
    else if (bitCount == 8)
        {
        outBuf <<= 4; //pad to make 12 bits

        int indx  = (int)((outBuf & 0x00000fc0L) >>  6);
        int obyte = (int)base64encode[indx & 63];
        putCh(obyte);

        indx      = (int)((outBuf & 0x0000003fL)      );
        obyte     = (int)base64encode[indx & 63];
        putCh(obyte);

        putCh('=');
        putCh('=');
        }

    if (columnWidth > 0) //if <=0, no newlines
        destination.put('\n');

    destination.close();
    closed = true;
}


Generated by  Doxygen 1.6.0   Back to index