org.apache.commons.net.tftp

## Class TFTPRequestPacket

- java.lang.Object
- - org.apache.commons.net.tftp.TFTPPacket
  - - org.apache.commons.net.tftp.TFTPRequestPacket

- Direct Known Subclasses:
    TFTPReadRequestPacket, TFTPWriteRequestPacket

      public abstract class TFTPRequestPacket
      extends TFTPPacket

  An abstract class derived from TFTPPacket definiing a TFTP Request packet type. It is subclassed by the `TFTPReadRequestPacket` and `TFTPWriteRequestPacket` classes.

  Details regarding the TFTP protocol and the format of TFTP packets can be found in RFC 783. But the point of these classes is to keep you from having to worry about the internals. Additionally, only very few people should have to care about any of the TFTPPacket classes or derived classes. Almost all users should only be concerned with the `TFTPClient` class `receiveFile()` and `sendFile()` methods.

  See Also:
    `TFTPPacket`, `TFTPReadRequestPacket`, `TFTPWriteRequestPacket`, `TFTPPacketException`, `TFTP`

- - ### Field Summary

    - ### Fields inherited from class org.apache.commons.net.tftp.TFTPPacket

      `ACKNOWLEDGEMENT, DATA, ERROR, READ_REQUEST, SEGMENT_SIZE, WRITE_REQUEST`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getFilename()` Returns the requested file name.
    `int` | `getMode()` Returns the transfer mode of the request.
    `DatagramPacket` | `newDatagram()` Creates a UDP datagram containing all the TFTP request packet data in the proper format.

    - ### Methods inherited from class org.apache.commons.net.tftp.TFTPPacket

      `getAddress, getPort, getType, newTFTPPacket, setAddress, setPort, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### newDatagram

          public final DatagramPacket newDatagram()

      Creates a UDP datagram containing all the TFTP request packet data in the proper format. This is a method exposed to the programmer in case he wants to implement his own TFTP client instead of using the `TFTPClient` class. Under normal circumstances, you should not have a need to call this method.
      Specified by:
        `newDatagram` in class `TFTPPacket`
      Returns:
        A UDP datagram containing the TFTP request packet.

    - #### getMode

          public final int getMode()

      Returns the transfer mode of the request.
      Returns:
        The transfer mode of the request.

    - #### getFilename

          public final String getFilename()

      Returns the requested file name.
      Returns:
        The requested file name.

Copyright © 2001–2021 The Apache Software Foundation. All rights reserved.