Class InputFile
- java.lang.Object
-
- org.telegram.telegrambots.meta.api.objects.InputFile
-
- All Implemented Interfaces:
Serializable,BotApiObject,InputBotApiObject,Validable
public class InputFile extends Object implements InputBotApiObject, Validable
- Version:
- 4.0.0 Input file used to upload a file to Telegram server and use it afterwards
- Author:
- Ruben Bermudez
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAttachName()StringgetMediaName()FilegetNewMediaFile()InputStreamgetNewMediaStream()booleanisNew()InputFilesetMedia(File mediaFile, String fileName)Use this setter to send new file.InputFilesetMedia(InputStream mediaStream, String fileName)Use this setter to send new file as stream.InputFilesetMedia(String attachName)voidvalidate()Validates that mandatory fields are filled and optional objects
-
-
-
Constructor Detail
-
InputFile
public InputFile()
-
InputFile
public InputFile(String attachName)
-
InputFile
public InputFile(File mediaFile, String fileName)
Constructor to set a new file- Parameters:
mediaFile- File to sendfileName- Name of the file
-
InputFile
public InputFile(InputStream mediaStream, String fileName)
Constructor to set a new file as stream- Parameters:
mediaStream- File to sendfileName- Name of the file
-
-
Method Detail
-
setMedia
public InputFile setMedia(File mediaFile, String fileName)
Use this setter to send new file.- Parameters:
mediaFile- File to sendfileName- Name of the file- Returns:
- This object
-
setMedia
public InputFile setMedia(InputStream mediaStream, String fileName)
Use this setter to send new file as stream.- Parameters:
mediaStream- File to sendfileName- Name of the file- Returns:
- This object
-
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 TelegramApiValidationExceptionDescription copied from interface:ValidableValidates that mandatory fields are filled and optional objects- Specified by:
validatein interfaceValidable- Throws:
TelegramApiValidationException- If any mandatory field is empty
-
-