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

📄 messagebytes.java

📁 一个简单的visio程序。
💻 JAVA
字号:

package servlet.http;

import java.io.IOException;
import java.io.OutputStream;
import servlet.util.Ascii;

// Referenced classes of package servlet.http:
//            HttpDate

public class MessageBytes extends Ascii
{

    public MessageBytes()
    {
    }

    public MessageBytes(byte abyte0[], int i, int j)
    {
        setBytes(abyte0, i, j);
    }

    public void reset()
    {
        bytes = null;
    }

    public void setBytes(byte abyte0[], int i, int j)
    {
        bytes = abyte0;
        offset = i;
        length = j;
    }

    public byte[] getBytes()
    {
        return bytes;
    }

    public int getBytes(byte abyte0[], int i)
    {
        if(bytes != null)
            System.arraycopy(bytes, offset, abyte0, i, length);
        return length;
    }

    public int getOffset()
    {
        return offset;
    }

    public int getLength()
    {
        return length;
    }

    public boolean isSet()
    {
        return bytes != null;
    }

    public String toString()
    {
        if(bytes != null)
            return new String(bytes, 0, offset, length);
        else
            return null;
    }

    public int toInteger()
        throws NumberFormatException
    {
        return Ascii.parseInt(bytes, offset, length);
    }

    public long toDate(HttpDate httpdate)
        throws IllegalArgumentException
    {
        if(bytes != null)
        {
            httpdate.parse(bytes, offset, length);
            return httpdate.getTime();
        }
        else
        {
            throw new IllegalArgumentException("invalid date format");
        }
    }

    public boolean equals(String s)
    {
        byte abyte0[] = bytes;
        int i = length;
        if(abyte0 == null || i != s.length())
            return false;
        int j = offset;
        for(int k = 0; k < i; k++)
            if(abyte0[j++] != s.charAt(k))
                return false;

        return true;
    }

    public boolean equalsIgnoreCase(String s)
    {
        byte abyte0[] = bytes;
        int i = length;
        if(abyte0 == null || i != s.length())
            return false;
        int j = offset;
        for(int k = 0; k < i; k++)
            if(Ascii.toLower(abyte0[j++]) != Ascii.toLower((byte)s.charAt(k)))
                return false;

        return true;
    }

    public boolean equals(byte abyte0[], int i, int j)
    {
        byte abyte1[] = bytes;
        if(abyte1 == null || j != length)
            return false;
        int k = offset;
        while(j-- > 0) 
            if(abyte0[i++] != abyte1[k++])
                return false;

        return true;
    }

    public boolean equalsIgnoreCase(byte abyte0[], int i, int j)
    {
        byte abyte1[] = bytes;
        if(abyte1 == null || j != length)
            return false;
        int k = offset;
        while(j-- > 0) 
            if(Ascii.toLower(abyte0[i++]) != Ascii.toLower(abyte1[k++]))
                return false;

        return true;
    }

    public boolean startsWith(String s)
    {
        byte abyte0[] = bytes;
        int i = s.length();
        if(abyte0 == null || i > length)
            return false;
        int j = offset;
        for(int k = 0; k < i; k++)
            if(abyte0[j++] != s.charAt(k))
                return false;

        return true;
    }

    public void write(OutputStream outputstream)
        throws IOException
    {
        if(bytes != null)
            outputstream.write(bytes, offset, length);
    }

    public int length()
    {
        if(bytes != null)
            return length;
        else
            return 0;
    }

    protected byte bytes[];
    protected int offset;
    protected int length;
}

⌨️ 快捷键说明

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