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

📄 httpclientholder.java

📁 手机上一个坦克游戏
💻 JAVA
字号:
package demo;

import java.io.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class HttpClientHolder {

    public byte revByte;
    public short revShort;
    public long revdLong;
    public int revInt;
    public String revString;
    public byte msgByte[];
    private ByteArrayInputStream byteArrayInputStream;
    public ByteArrayOutputStream byteArrayOutputStream;
    public DataInputStream dataInputStream;
    public DataOutputStream dataOutputStream;
    public HttpClientHolder() {
        try {
            byteArrayOutputStream = new ByteArrayOutputStream();
            dataOutputStream = new DataOutputStream(byteArrayOutputStream);
        }
        catch (Exception e) {
            e.printStackTrace();
        }

    }

    public HttpClientHolder(byte InputBytes[]) {
        try {
            byteArrayInputStream = new ByteArrayInputStream(InputBytes);
            dataInputStream = new DataInputStream(byteArrayInputStream);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
/*
    public HttpClientHolder(int Byte, int Integer, int Short) {
        try {
            byteArrayOutputStream = new ByteArrayOutputStream();
            dataOutputStream = new DataOutputStream(byteArrayOutputStream);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }*/

    //write data to outputstream
    //write integer to outputstream
    //
    //params@ iTmp : integer
    //
    public void WriteInt(int iTmp) {
        try {
            //System.out.println("WriteInt:" + iTmp);
            dataOutputStream.writeInt(iTmp);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    //write long to outputstream
    //
    //params@ lTmp : long integer
    //
    /*public void WriteLong(long lTmp) {
        try {
            dataOutputStream.writeLong(lTmp);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }*/

    //write short integer to outputstream
    //
    //params@ shTmp : short integer
    //
    public void WriteShort(short shTmp) {
        try {
            dataOutputStream.writeShort(shTmp);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    //write string to outputstream
    //
    //params@ sTmp : string
    //
    public void WriteUTF(String sTmp) {
        try {
            dataOutputStream.writeUTF(sTmp);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    //wirte byte to outputstream
    //
    //params@ bTmp : byte
    //
    public void WriteByte(byte bTmp) {
        try {
            dataOutputStream.writeByte(bTmp);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    //write boolean to outputstream
    //
    //parmas@ blTmp : boolean
    //
    /*public void WriteBoolean(boolean blTmp) {
        try {
            dataOutputStream.writeBoolean(blTmp);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }*/

    public String ReadUTF() throws IOException {
        return dataInputStream.readUTF();
    }

    public int ReadInt() throws IOException {
        return dataInputStream.readInt();
    }

    public byte ReadByte() throws IOException {
        return dataInputStream.readByte();
    }

    /*public long ReadLong() throws IOException {
        long result = -1L;
        result = dataInputStream.readLong();
        return result;
    }*/

    public short ReadShort() throws IOException {
        return dataInputStream.readShort();
    }

    public byte[] ToSentBytes() {
        return byteArrayOutputStream.toByteArray();
    }
}

⌨️ 快捷键说明

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