Package com.restfb
Class BinaryAttachment
- java.lang.Object
-
- com.restfb.BinaryAttachment
-
- Direct Known Subclasses:
FacebookReelAttachment
public class BinaryAttachment extends Object
Represents a binary file that can be uploaded to Facebook.Normally this would be a photo or video.
- Since:
- 1.6.5
- Author:
- Mark Allen, Marcel Stoer
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
data
-
Constructor Summary
Constructors Modifier Constructor Description protected
BinaryAttachment()
protected
BinaryAttachment(String filename, byte[] data)
Creates a new binary attachment.protected
BinaryAttachment(String filename, byte[] data, String contentType)
Creates a new binary attachment.protected
BinaryAttachment(String filename, InputStream data)
Deprecated.use the stream-less API passing abyte[]
for dataprotected
BinaryAttachment(String filename, InputStream data, String contentType)
Deprecated.use the stream-less API passing abyte[]
for dataprotected
BinaryAttachment(String fieldName, String filename, byte[] data)
Creates a new binary attachment.protected
BinaryAttachment(String fieldName, String filename, byte[] data, String contentType)
Creates a new binary attachment.protected
BinaryAttachment(String fieldName, String filename, InputStream data)
Deprecated.use the stream-less API passing abyte[]
for dataprotected
BinaryAttachment(String fieldName, String filename, InputStream data, String contentType)
Deprecated.use the stream-less API passing abyte[]
for data
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(Object that)
String
getContentType()
return the given content type or try to guess from stream or file name.InputStream
getData()
The attachment's data.String
getFieldName()
String
getFilename()
boolean
hasBinaryData()
int
hashCode()
boolean
isFacebookReel()
String
toString()
static BinaryAttachment
with(String filename, byte[] data)
Creates a binary attachment.static BinaryAttachment
with(String filename, byte[] data, String contentType)
Creates a binary attachment.static BinaryAttachment
with(String filename, InputStream data)
Deprecated.use the stream-less API passing abyte[]
for datastatic BinaryAttachment
with(String filename, InputStream data, String contentType)
Deprecated.use the stream-less API passing abyte[]
for data insteadstatic BinaryAttachment
with(String fieldName, String filename, byte[] data)
Creates a binary attachment.static BinaryAttachment
with(String fieldName, String filename, byte[] data, String contentType)
Creates a binary attachment.static BinaryAttachment
with(String fieldName, String filename, InputStream data)
Deprecated.use the stream-less API passing abyte[]
for datastatic BinaryAttachment
with(String fieldName, String filename, InputStream data, String contentType)
Deprecated.use the stream-less API passing abyte[]
for data
-
-
-
Field Detail
-
data
protected byte[] data
-
-
Constructor Detail
-
BinaryAttachment
protected BinaryAttachment()
-
BinaryAttachment
@Deprecated protected BinaryAttachment(String filename, InputStream data)
Deprecated.use the stream-less API passing abyte[]
for dataCreates a new binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.
-
BinaryAttachment
@Deprecated protected BinaryAttachment(String fieldName, String filename, InputStream data)
Deprecated.use the stream-less API passing abyte[]
for dataCreates a new binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.fieldName
- The field name the binary belongs to- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.
-
BinaryAttachment
@Deprecated protected BinaryAttachment(String filename, InputStream data, String contentType)
Deprecated.use the stream-less API passing abyte[]
for dataCreates a new binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.contentType
- The attachment's contentType.- Throws:
IllegalArgumentException
- Ifdata
isnull
,filename
isnull
or blank, orcontentType
isnull
or blank.- Since:
- 1.6.13
-
BinaryAttachment
@Deprecated protected BinaryAttachment(String fieldName, String filename, InputStream data, String contentType)
Deprecated.use the stream-less API passing abyte[]
for dataCreates a new binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.contentType
- The attachment's contentType.fieldName
- The field name the binary belongs to- Throws:
IllegalArgumentException
- Ifdata
isnull
,filename
isnull
or blank, orcontentType
isnull
or blank.- Since:
- 1.6.13
-
BinaryAttachment
protected BinaryAttachment(String filename, byte[] data)
Creates a new binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.- Since:
- 1.6.17
-
BinaryAttachment
protected BinaryAttachment(String fieldName, String filename, byte[] data)
Creates a new binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.fieldName
- The field name the binary belongs to- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.- Since:
- 1.6.17
-
BinaryAttachment
protected BinaryAttachment(String filename, byte[] data, String contentType)
Creates a new binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.contentType
- The attachment's contentType.- Throws:
IllegalArgumentException
- Ifdata
isnull
,filename
isnull
or blank, orcontentType
isnull
or blank.- Since:
- 1.6.17
-
BinaryAttachment
protected BinaryAttachment(String fieldName, String filename, byte[] data, String contentType)
Creates a new binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.contentType
- The attachment's contentType.fieldName
- The field name the binary belongs to- Throws:
IllegalArgumentException
- Ifdata
isnull
,filename
isnull
or blank, orcontentType
isnull
or blank.- Since:
- 1.6.17
-
-
Method Detail
-
isFacebookReel
public boolean isFacebookReel()
-
with
@Deprecated public static BinaryAttachment with(String filename, InputStream data)
Deprecated.use the stream-less API passing abyte[]
for dataCreates a binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.- Returns:
- A binary attachment.
- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.
-
with
@Deprecated public static BinaryAttachment with(String fieldName, String filename, InputStream data)
Deprecated.use the stream-less API passing abyte[]
for dataCreates a binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.fieldName
- The field name the binary belongs to- Returns:
- A binary attachment.
- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.
-
with
@Deprecated public static BinaryAttachment with(String filename, InputStream data, String contentType)
Deprecated.use the stream-less API passing abyte[]
for data insteadCreates a binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.contentType
- The attachment's contentType.- Returns:
- A binary attachment.
- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.
-
with
@Deprecated public static BinaryAttachment with(String fieldName, String filename, InputStream data, String contentType)
Deprecated.use the stream-less API passing abyte[]
for dataCreates a binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.fieldName
- The field name the binary belongs to- Returns:
- A binary attachment.
- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.
-
with
public static BinaryAttachment with(String filename, byte[] data)
Creates a binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.- Returns:
- A binary attachment.
- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.- Since:
- 1.6.17
-
with
public static BinaryAttachment with(String fieldName, String filename, byte[] data)
Creates a binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.fieldName
- The field name the binary belongs to- Returns:
- A binary attachment.
- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.- Since:
- 1.6.17
-
with
public static BinaryAttachment with(String filename, byte[] data, String contentType)
Creates a binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.contentType
- The attachment's contentType.- Returns:
- A binary attachment.
- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.- Since:
- 1.6.17
-
with
public static BinaryAttachment with(String fieldName, String filename, byte[] data, String contentType)
Creates a binary attachment.- Parameters:
filename
- The attachment's filename.data
- The attachment's data.contentType
- The attachment's contentType.fieldName
- The field name the binary belongs to- Returns:
- A binary attachment.
- Throws:
IllegalArgumentException
- Ifdata
isnull
orfilename
isnull
or blank.- Since:
- 1.6.17
-
getData
public InputStream getData()
The attachment's data.- Returns:
- The attachment's data.
-
getContentType
public String getContentType()
return the given content type or try to guess from stream or file name. Depending of the available data.- Returns:
- the content type
-
hasBinaryData
public boolean hasBinaryData()
-
getFilename
public String getFilename()
-
getFieldName
public String getFieldName()
-
-