com.notnoop.apns.internal
Class Utilities

java.lang.Object
  extended by com.notnoop.apns.internal.Utilities

public final class Utilities
extends Object


Field Summary
static int MAX_PAYLOAD_LENGTH
           
static String PRODUCTION_FEEDBACK_HOST
           
static int PRODUCTION_FEEDBACK_PORT
           
static String PRODUCTION_GATEWAY_HOST
           
static int PRODUCTION_GATEWAY_PORT
           
static String SANDBOX_FEEDBACK_HOST
           
static int SANDBOX_FEEDBACK_PORT
           
static String SANDBOX_GATEWAY_HOST
           
static int SANDBOX_GATEWAY_PORT
           
 
Method Summary
static void close(Closeable closeable)
           
static void close(Socket closeable)
           
static byte[] copyOf(byte[] bytes)
           
static byte[] copyOfRange(byte[] original, int from, int to)
           
static byte[] decodeHex(String deviceToken)
           
static String encodeHex(byte[] bytes)
           
static byte[] marshall(byte command, byte[] deviceToken, byte[] payload)
           
static byte[] marshallEnhanced(byte command, int identifier, int expiryTime, byte[] deviceToken, byte[] payload)
           
static SSLContext newSSLContext(InputStream cert, String password, String ksType, String ksAlgorithm)
           
static SSLContext newSSLContext(KeyStore ks, String password, String ksAlgorithm)
           
static SSLSocketFactory newSSLSocketFactory(InputStream cert, String password, String ksType, String ksAlgorithm)
           
static int parseBytes(int b1, int b2, int b3, int b4)
           
static Map<String,Date> parseFeedbackStream(InputStream in)
           
static Map<byte[],Integer> parseFeedbackStreamRaw(InputStream in)
           
static void sleep(int delay)
           
static byte[] toUTF8Bytes(String s)
           
static String truncateWhenUTF8(String s, int maxBytes)
           
static void wrapAndThrowAsRuntimeException(Exception e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SANDBOX_GATEWAY_HOST

public static final String SANDBOX_GATEWAY_HOST
See Also:
Constant Field Values

SANDBOX_GATEWAY_PORT

public static final int SANDBOX_GATEWAY_PORT
See Also:
Constant Field Values

SANDBOX_FEEDBACK_HOST

public static final String SANDBOX_FEEDBACK_HOST
See Also:
Constant Field Values

SANDBOX_FEEDBACK_PORT

public static final int SANDBOX_FEEDBACK_PORT
See Also:
Constant Field Values

PRODUCTION_GATEWAY_HOST

public static final String PRODUCTION_GATEWAY_HOST
See Also:
Constant Field Values

PRODUCTION_GATEWAY_PORT

public static final int PRODUCTION_GATEWAY_PORT
See Also:
Constant Field Values

PRODUCTION_FEEDBACK_HOST

public static final String PRODUCTION_FEEDBACK_HOST
See Also:
Constant Field Values

PRODUCTION_FEEDBACK_PORT

public static final int PRODUCTION_FEEDBACK_PORT
See Also:
Constant Field Values

MAX_PAYLOAD_LENGTH

public static final int MAX_PAYLOAD_LENGTH
See Also:
Constant Field Values
Method Detail

newSSLSocketFactory

public static SSLSocketFactory newSSLSocketFactory(InputStream cert,
                                                   String password,
                                                   String ksType,
                                                   String ksAlgorithm)
                                            throws InvalidSSLConfig
Throws:
InvalidSSLConfig

newSSLContext

public static SSLContext newSSLContext(InputStream cert,
                                       String password,
                                       String ksType,
                                       String ksAlgorithm)
                                throws InvalidSSLConfig
Throws:
InvalidSSLConfig

newSSLContext

public static SSLContext newSSLContext(KeyStore ks,
                                       String password,
                                       String ksAlgorithm)
                                throws InvalidSSLConfig
Throws:
InvalidSSLConfig

decodeHex

public static byte[] decodeHex(String deviceToken)

encodeHex

public static String encodeHex(byte[] bytes)

toUTF8Bytes

public static byte[] toUTF8Bytes(String s)

marshall

public static byte[] marshall(byte command,
                              byte[] deviceToken,
                              byte[] payload)

marshallEnhanced

public static byte[] marshallEnhanced(byte command,
                                      int identifier,
                                      int expiryTime,
                                      byte[] deviceToken,
                                      byte[] payload)

parseFeedbackStreamRaw

public static Map<byte[],Integer> parseFeedbackStreamRaw(InputStream in)

parseFeedbackStream

public static Map<String,Date> parseFeedbackStream(InputStream in)

close

public static void close(Closeable closeable)

close

public static void close(Socket closeable)

sleep

public static void sleep(int delay)

copyOf

public static byte[] copyOf(byte[] bytes)

copyOfRange

public static byte[] copyOfRange(byte[] original,
                                 int from,
                                 int to)

wrapAndThrowAsRuntimeException

public static void wrapAndThrowAsRuntimeException(Exception e)
                                           throws NetworkIOException
Throws:
NetworkIOException

parseBytes

public static int parseBytes(int b1,
                             int b2,
                             int b3,
                             int b4)

truncateWhenUTF8

public static String truncateWhenUTF8(String s,
                                      int maxBytes)


Copyright © 2013. All Rights Reserved.