communication.java

来自「PracticalJAVACode 的源码」· Java 代码 · 共 33 行

JAVA
33
字号
import java.net.*;
import java.io.*;
class Communication
{
  private ServerSocket ss;
  private FileInputStream fileIn;
  //...
  public synchronized void cleanup() throws IOException
  {
    if (ss != null)
    {
      ss.close();
      ss = null;
    }
    if (fileIn != null)
    {
      fileIn.close();
      fileIn = null;
    }
  }

  protected void finalize() throws Throwable
  {
    try {
      cleanup();
    }
    finally {
      super.finalize();
    }
  }
  //...
}

⌨️ 快捷键说明

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