一个
File对象表示的 路径
到该文件,而不是它的实际内容。您应该做的是
byte从该文件中读取,然后通过将该文件发送出去
ObjectOutputStream。
File f = ...ObjectOutputStream oos = ...byte[] content = Files.readAllBytes(f.toPath);oos.writeObject(content);File f=...ObjectInputStream ois = ...byte[] content = (byte[]) ois.readObject();Files.write(f.toPath(), content);



