java.lang.Object
org.telegram.telegrambots.meta.api.objects.InputFile
All Implemented Interfaces:
Serializable, BotApiObject, Validable

public class InputFile extends Object implements Validable, BotApiObject
Input file used to upload a file to Telegram server and use it afterwards
Version:
4.0.0
Author:
Ruben Bermudez
See Also:
  • Constructor Details

    • InputFile

      public InputFile(String attachName)
    • InputFile

      public InputFile(File mediaFile)
      Constructor to set a new file
      Parameters:
      mediaFile - File to send
    • InputFile

      public InputFile(File mediaFile, String fileName)
      Constructor to set a new file
      Parameters:
      mediaFile - File to send
      fileName - Name of the file
    • InputFile

      public InputFile(InputStream mediaStream, String fileName)
      Constructor to set a new file as stream
      Parameters:
      mediaStream - File to send
      fileName - Name of the file
  • Method Details

    • setMedia

      public InputFile setMedia(File mediaFile, String fileName)
      Use this setter to send new file.
      Parameters:
      mediaFile - File to send
      fileName - Name of the file
      Returns:
      This object
    • setMedia

      public InputFile setMedia(File mediaFile)
      Use this setter to send new file.
      Parameters:
      mediaFile - File to send
      Returns:
      This object
    • setMedia

      public InputFile setMedia(InputStream mediaStream, String fileName)
      Use this setter to send new file as stream.
      Parameters:
      mediaStream - File to send
      fileName - Name of the file
      Returns:
      This object
    • setMedia

      public InputFile setMedia(String attachName)
    • getAttachName

      public String getAttachName()
    • getMediaName

      public String getMediaName()
    • getNewMediaFile

      public File getNewMediaFile()
    • getNewMediaStream

      public InputStream getNewMediaStream()
    • isNew

      public boolean isNew()
    • validate

      public void validate() throws TelegramApiValidationException
      Description copied from interface: Validable
      Validates that mandatory fields are filled and optional objects
      Specified by:
      validate in interface Validable
      Throws:
      TelegramApiValidationException - If any mandatory field is empty