List of usage examples for org.apache.commons.net.tftp.tftpserver TFTPServer TFTPServer
public TFTPServer(File serverReadDirectory, File serverWriteDirectory, ServerMode mode) throws IOException
From source file:com.thesmartguild.firmloader.lib.tftp.TFTPServerFactory.java
public static TFTPServer instantiate(File file) { try {// w w w .j a v a 2 s. c o m TFTPServer TFTPServer_; Path tmpFilePath = TFTPServerFactory.createTempDirectory(); Path filePath = Files.copy(file.toPath(), Paths.get(tmpFilePath.toString(), file.getName()), StandardCopyOption.REPLACE_EXISTING); filePath.toFile().deleteOnExit(); TFTPServer_ = new TFTPServer(tmpFilePath.toFile(), tmpFilePath.toFile(), ServerMode.GET_ONLY); TFTPServer_.setLog(System.out); TFTPServer_.setLogError(System.out); return TFTPServer_; } catch (IOException e) { e.printStackTrace(); return null; } }
From source file:com.thesmartguild.firmloader.lib.tftp.TFTPServerFactory.java
public static ServerInfo instantiate() { try {/*from w w w .j a v a 2 s . c o m*/ Path tmpFilePath = TFTPServerFactory.createTempDirectory(); TFTPServer serv = new TFTPServer(tmpFilePath.toFile(), tmpFilePath.toFile(), ServerMode.GET_ONLY); return new TFTPServerFactory().new ServerInfo(serv, tmpFilePath); } catch (IOException e) { e.printStackTrace(); return null; } }