Package com.restfb

Class BinaryAttachment

    • Field Detail

      • data

        protected byte[] data
    • Constructor Detail

      • BinaryAttachment

        @Deprecated
        protected BinaryAttachment​(String filename,
                                   InputStream data)
        Deprecated.
        use the stream-less API passing a byte[] for data
        Creates a new binary attachment.
        Parameters:
        filename - The attachment's filename.
        data - The attachment's data.
        Throws:
        IllegalArgumentException - If data is null or filename is null or blank.
      • BinaryAttachment

        @Deprecated
        protected BinaryAttachment​(String fieldName,
                                   String filename,
                                   InputStream data)
        Deprecated.
        use the stream-less API passing a byte[] for 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 - If data is null or filename is null or blank.
      • BinaryAttachment

        @Deprecated
        protected BinaryAttachment​(String filename,
                                   InputStream data,
                                   String contentType)
        Deprecated.
        use the stream-less API passing a byte[] for data
        Creates a new binary attachment.
        Parameters:
        filename - The attachment's filename.
        data - The attachment's data.
        contentType - The attachment's contentType.
        Throws:
        IllegalArgumentException - If data is null, filename is null or blank, or contentType is null 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 a byte[] for data
        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 - If data is null, filename is null or blank, or contentType is null 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 - If data is null or filename is null 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 - If data is null or filename is null 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 - If data is null, filename is null or blank, or contentType is null 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 - If data is null, filename is null or blank, or contentType is null or blank.
        Since:
        1.6.17
    • Method Detail

      • with

        @Deprecated
        public static BinaryAttachment with​(String filename,
                                            InputStream data)
        Deprecated.
        use the stream-less API passing a byte[] for data
        Creates a binary attachment.
        Parameters:
        filename - The attachment's filename.
        data - The attachment's data.
        Returns:
        A binary attachment.
        Throws:
        IllegalArgumentException - If data is null or filename is null or blank.
      • with

        @Deprecated
        public static BinaryAttachment with​(String fieldName,
                                            String filename,
                                            InputStream data)
        Deprecated.
        use the stream-less API passing a byte[] for 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 - If data is null or filename is null or blank.
      • with

        @Deprecated
        public static BinaryAttachment with​(String filename,
                                            InputStream data,
                                            String contentType)
        Deprecated.
        use the stream-less API passing a byte[] for data instead
        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 - If data is null or filename is null or blank.
      • with

        @Deprecated
        public static BinaryAttachment with​(String fieldName,
                                            String filename,
                                            InputStream data,
                                            String contentType)
        Deprecated.
        use the stream-less API passing a byte[] for 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 - If data is null or filename is null 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 - If data is null or filename is null 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 - If data is null or filename is null 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 - If data is null or filename is null 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 - If data is null or filename is null 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