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

📄 userdata.java

📁 JAVA写的一个机器人程序
💻 JAVA
字号:
package rebot;

import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

public class userdata {
    public static void userdata(String phrase, String dirname, String filename) {
        File dir = new File(dirname);
        File aFile = new File(dir, filename);
        FileOutputStream outputFile = null;
        try {
            outputFile = new FileOutputStream(aFile, true);
        } catch (FileNotFoundException e) {
            e.printStackTrace(System.err);
        }
        FileChannel outChannel = outputFile.getChannel();
        ByteBuffer buf = ByteBuffer.allocate(phrase.length() * 2);
        buf.clear();
        for (char ch : phrase.toCharArray()) {
            buf.putChar(ch);

        }
        buf.flip();
        buf.clear();
        try {
            outChannel.write(buf);
            outputFile.close();
            buf.clear();
        } catch (IOException e) {
            e.printStackTrace(System.err);
        }
    }
}

⌨️ 快捷键说明

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