⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asciioutputstream.java~1~

📁 封装了SQL、Socket、WAP、MIME等功能的通用组件
💻 JAVA~1~
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name:   MimeUtility.java

package com.lazybug.mime;

import java.io.*;

// Referenced classes of package javax.mail.internet:
//            MimeUtility

class AsciiOutputStream extends OutputStream
{

    private boolean breakOnNonAscii;
    private int ascii;
    private int non_ascii;
    private int linelen;
    private boolean longLine;
    private boolean badEOL;
    private boolean checkEOL;
    private int lastb;
    private int ret;

    public AsciiOutputStream(boolean flag, boolean flag1)
    {
        longLine = false;
        badEOL = false;
        checkEOL = false;
        breakOnNonAscii = flag;
        checkEOL = flag1 && flag;
    }

    public void write(int i)
        throws IOException
    {
        check(i);
    }

    public void write(byte abyte0[])
        throws IOException
    {
        write(abyte0, 0, abyte0.length);
    }

    public void write(byte abyte0[], int i, int j)
        throws IOException
    {
        j += i;
        for(int k = i; k < j; k++)
            check(abyte0[k]);

    }

    private final void check(int i)
        throws IOException
    {
        i &= 0xff;
        if(checkEOL && (lastb == 13 && i != 10 || lastb != 13 && i == 10))
            badEOL = true;
        if(i == 13 || i == 10)
        {
            linelen = 0;
        } else
        {
            linelen++;
            if(linelen > 998)
                longLine = true;
        }
        if(MimeUtility.nonascii(i))
        {
            non_ascii++;
            if(breakOnNonAscii)
            {
                ret = 3;
                throw new EOFException();
            }
        } else
        {
            ascii++;
        }
        lastb = i;
    }

    public int getAscii()
    {
        if(ret != 0)
            return ret;
        if(badEOL)
            return 3;
        if(non_ascii == 0)
            return !longLine ? 1 : 2;
        return ascii <= non_ascii ? 3 : 2;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -