Example usage for org.apache.commons.net.tftp.tftpserver TFTPServer setLog

List of usage examples for org.apache.commons.net.tftp.tftpserver TFTPServer setLog

Introduction

In this page you can find the example usage for org.apache.commons.net.tftp.tftpserver TFTPServer setLog.

Prototype

public void setLog(PrintStream log) 

Source Link

Document

Set the stream object to log debug / informational messages.

Usage

From source file:com.thesmartguild.firmloader.lib.tftp.TFTPServerFactory.java

public static TFTPServer instantiate(File file) {
    try {/*  w  ww .j a v  a2 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;
    }
}