📄 fileclient.java
字号:
/*
* FileClient.java
*
* Created on 2008年4月26日, 上午1:43
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
/**
*
* @author 602
*/
import java.io.*;
import java.net.*;
public class FileClient extends Thread
{
/** Creates a new instance of FileClient */
public FileClient() {
}
public void run()
{
try
{
File file=new File("d://","newFile.jpg");
if(file.exists())
{
file.delete();
}
file.createNewFile();
RandomAccessFile wFile=new RandomAccessFile(file,"rw");
Socket server=new Socket(InetAddress.getLocalHost(),9000);
DataInputStream in=null;
in=new DataInputStream(server.getInputStream());
byte[] buf=new byte[2048];
int num=in.read(buf);
while(num!=(-1))
{
wFile.write(buf);
num=in.read(buf);
}
in.close();
wFile.close();
}
catch(Exception e)
{}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -