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

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

Introduction

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

Prototype

public void setLogError(PrintStream logError) 

Source Link

Document

Set the stream object to log error messsages.

Usage

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

public static TFTPServer instantiate(File file) {
    try {/*from   w w  w.  j  a  v  a 2  s.c om*/
        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;
    }
}