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

📄 pcbinaryoutputstream.java

📁 使用java编写的LSB图像信息隐藏算法演示程序
💻 JAVA
字号:
package hideInfo;


import java.io.*;
import java.net.URL;

public class PCBinaryOutputStream {

    DataOutputStream file;

    public PCBinaryOutputStream(File f) throws IOException
    {
        file = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(f)));
    }

    public PCBinaryOutputStream(URL url) throws IOException
    {
        file = new DataOutputStream(new BufferedOutputStream((url.openConnection()).getOutputStream()));
    }

    public void writeInt(int i) throws IOException
    {
        int j=(i<<24)|((i&0x0000FF00)<<8)|((i&0x00FF0000)>>>8)|(i>>>24);
        file.writeInt(j);
    }

    public void writeShort(short i) throws IOException
    {
        int j=(i<<8)|(i>>>8);
        file.writeShort((short)j);
    }

    public void writeByte(byte i) throws IOException
    {
        file.writeByte(i);
    }

    public void writeByteArray(byte b[]) throws IOException
    {
        file.write(b);
    }

    public long getFilePointer() throws IOException
    {
        return file.size();
    }

    public long size() throws IOException
    {
        return file.size();
    }

    public void close() throws IOException
    {
        file.flush();
        file.close();
        file=null;
    }

    public void finalize() {
        if (file != null) {
            try {
                close();
            } catch (IOException e) {}
        }
    }
}

⌨️ 快捷键说明

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