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

📄 bytesutile.java

📁 封装了SQL、Socket、WAP、MIME等功能的通用组件
💻 JAVA
字号:
package org.lazybug.util;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: lazybug</p>
 *
 * @author David Lau
 * @version 1.0
 */
public class BytesUtile
{
    private static final int SIZE = 500*1024;
    private static byte[] buffer = new byte[SIZE];
    private static int index = 0;

    public static void init()
    {
        index = 0;
    }

    public static void write(int ch)
    {
        buffer[index++] = (byte)ch;
    }

    public static void rollback(int k)
    {
        index -= k;
        if( index < 0 ) index = 0;
    }

    public static byte[] getPayload()
    {
//        System.out.println("getPayload:"+index);
        byte buf[] = new byte[index];
        index = 0;
        Tools.copyByteArray(buffer, buf);
        return buf;
    }

    public static void main( String[] args )
    {
        BytesUtile bytesutile = new BytesUtile();
    }
}

⌨️ 快捷键说明

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