Class FileInputBody
-
- All Implemented Interfaces:
public final class FileInputBody extends RequestBody
Represents the body of a network request containing a file input.
-
-
Constructor Summary
Constructors Constructor Description FileInputBody(String fileName, String contentType, Integer encoding)
-
Method Summary
Modifier and Type Method Description final StringgetFileName()The name of the file to upload. final UnitsetFileName(String fileName)The name of the file to upload. UnitwriteToStream(BufferedSink bufferedSink)Writes the file content to the provided BufferedSink. StringgetContentType()Gets the content type of the file body. BufferedSourcegetSource()Gets a BufferedSource for reading the file content. -
-
Method Detail
-
getFileName
final String getFileName()
The name of the file to upload.
-
setFileName
final Unit setFileName(String fileName)
The name of the file to upload.
-
writeToStream
Unit writeToStream(BufferedSink bufferedSink)
Writes the file content to the provided BufferedSink.
- Parameters:
bufferedSink- The sink to write the file data to.
-
getContentType
String getContentType()
Gets the content type of the file body.
- Returns:
The content type string.
-
getSource
BufferedSource getSource()
Gets a BufferedSource for reading the file content.
- Returns:
A BufferedSource for the file.
-
-
-
-