twitter4j.util
Class ImageUpload

java.lang.Object
  extended by twitter4j.util.ImageUpload
Direct Known Subclasses:
ImageUpload.ImgLyOAuthUploader, ImageUpload.TweetPhotoOAuthUploader, ImageUpload.TwitgooOAuthUploader, ImageUpload.TwitpicBasicAuthUploader, ImageUpload.TwitpicOAuthUploader, ImageUpload.YFrogBasicAuthUploader, ImageUpload.YFrogOAuthUploader

public abstract class ImageUpload
extends java.lang.Object

Since:
Twitter4J 2.1.3
Author:
Rémy Rakic - remy.rakic at gmail.com

Nested Class Summary
static class ImageUpload.ImgLyOAuthUploader
           
static class ImageUpload.TweetPhotoOAuthUploader
           
static class ImageUpload.TwitgooOAuthUploader
           
private static class ImageUpload.TwitpicBasicAuthUploader
           
private static class ImageUpload.TwitpicOAuthUploader
           
private static class ImageUpload.YFrogBasicAuthUploader
           
private static class ImageUpload.YFrogOAuthUploader
           
 
Field Summary
static java.lang.String DEFAULT_TWITPIC_API_KEY
           
 
Constructor Summary
ImageUpload()
           
 
Method Summary
private static twitter4j.internal.http.HttpParameter[] appendHttpParameters(twitter4j.internal.http.HttpParameter[] src, twitter4j.internal.http.HttpParameter[] dst)
           
private static void ensureBasicEnabled(Authorization auth)
           
static ImageUpload getImgLyUploader(OAuthAuthorization auth)
          Returns an OAuth image uploader to img.ly
static ImageUpload getTweetPhotoUploader(java.lang.String tweetPhotoAPIKey, OAuthAuthorization auth)
          Returns an OAuth image uploader to TweetPhoto
static ImageUpload getTwitgooUploader(OAuthAuthorization auth)
          Returns an OAuth image uploader to Twitgoo
static ImageUpload getTwitpicUploader(BasicAuthorization auth)
          Returns a BasicAuth image uploader to Twitpic
static ImageUpload getTwitpicUploader(java.lang.String twitpicAPIKey, OAuthAuthorization auth)
          Returns an OAuth image uploader to Twitpic
static ImageUpload getTwitpicUploader(Twitter twitter)
          Returns an image uploader to Twitpic.
static ImageUpload getYFrogUploader(BasicAuthorization auth)
          Returns a BasicAuth image uploader to YFrog
static ImageUpload getYFrogUploader(java.lang.String userId, OAuthAuthorization auth)
          Returns an OAuth image uploader to YFrog
static ImageUpload getYFrogUploader(Twitter twitter)
          Returns an image uploader to YFrog.
abstract  java.lang.String upload(java.io.File image)
           
abstract  java.lang.String upload(java.io.File image, java.lang.String message)
           
abstract  java.lang.String upload(java.lang.String imageFileName, java.io.InputStream imageBody)
           
abstract  java.lang.String upload(java.lang.String imageFileName, java.io.InputStream imageBody, java.lang.String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TWITPIC_API_KEY

public static java.lang.String DEFAULT_TWITPIC_API_KEY
Constructor Detail

ImageUpload

public ImageUpload()
Method Detail

upload

public abstract java.lang.String upload(java.io.File image)
                                 throws TwitterException
Throws:
TwitterException

upload

public abstract java.lang.String upload(java.io.File image,
                                        java.lang.String message)
                                 throws TwitterException
Throws:
TwitterException

upload

public abstract java.lang.String upload(java.lang.String imageFileName,
                                        java.io.InputStream imageBody)
                                 throws TwitterException
Throws:
TwitterException

upload

public abstract java.lang.String upload(java.lang.String imageFileName,
                                        java.io.InputStream imageBody,
                                        java.lang.String message)
                                 throws TwitterException
Throws:
TwitterException

getTwitpicUploader

public static ImageUpload getTwitpicUploader(Twitter twitter)
                                      throws TwitterException
Returns an image uploader to Twitpic. Handles both BasicAuth and OAuth. Note: When using OAuth, the Twitpic API Key needs to be specified, either with the field ImageUpload.DEFAULT_TWITPIC_API_KEY, or using the getTwitpicUploader (String twitpicAPIKey, OAuthAuthorization auth) method

Throws:
TwitterException

getTwitpicUploader

public static ImageUpload getTwitpicUploader(BasicAuthorization auth)
Returns a BasicAuth image uploader to Twitpic


getTwitpicUploader

public static ImageUpload getTwitpicUploader(java.lang.String twitpicAPIKey,
                                             OAuthAuthorization auth)
Returns an OAuth image uploader to Twitpic


getTweetPhotoUploader

public static ImageUpload getTweetPhotoUploader(java.lang.String tweetPhotoAPIKey,
                                                OAuthAuthorization auth)
Returns an OAuth image uploader to TweetPhoto


getYFrogUploader

public static ImageUpload getYFrogUploader(Twitter twitter)
                                    throws TwitterException
Returns an image uploader to YFrog. Handles both BasicAuth and OAuth

Throws:
TwitterException

getYFrogUploader

public static ImageUpload getYFrogUploader(BasicAuthorization auth)
Returns a BasicAuth image uploader to YFrog


getYFrogUploader

public static ImageUpload getYFrogUploader(java.lang.String userId,
                                           OAuthAuthorization auth)
Returns an OAuth image uploader to YFrog


getImgLyUploader

public static ImageUpload getImgLyUploader(OAuthAuthorization auth)
Returns an OAuth image uploader to img.ly


getTwitgooUploader

public static ImageUpload getTwitgooUploader(OAuthAuthorization auth)
Returns an OAuth image uploader to Twitgoo


ensureBasicEnabled

private static void ensureBasicEnabled(Authorization auth)

appendHttpParameters

private static twitter4j.internal.http.HttpParameter[] appendHttpParameters(twitter4j.internal.http.HttpParameter[] src,
                                                                            twitter4j.internal.http.HttpParameter[] dst)