javapns/src/main/java/javapns/notification/Payload.java
/**
	 * Estimate the size that this payload will take after adding a given property.
	 * For performance reasons, this estimate is not as reliable as actually adding
	 * the property and checking the payload size afterwards.
	 *
	 * Currently works well with strings and numbers.
	 *
	 * @param propertyName the name of the property to use for calculating the estimation
	 * @param propertyValue the value of the property to use for calculating the estimation
	 * @return an estimated payload size if the property were to be added to the payload
	 */
Estimate the size that this payload will take after adding a given property.
For performance reasons, this estimate is not as reliable as actually adding
the property and checking the payload size afterwards.

Currently works well with strings and numbers.

@param propertyName the name of the property to use for calculating the estimation
@param propertyValue the value of the property to use for calculating the estimation
@return an estimated payload size if the property were to be added to the payload
Estimate the size that this payload will take after adding a given property . For performance reasons this estimate is not as reliable as actually adding the property and checking the payload size afterwards . Currently works well with strings and numbers . @param propertyName the name of the property to use for calculating the estimation @param propertyValue the value of the property to use for calculating the estimation @return an estimated payload size if the property were to be added to the payload
public int estimatePayloadSizeAfterAdding(String propertyName, Object propertyValue) {
		try {
			int maximumPayloadSize = getMaximumPayloadSize();
			int currentPayloadSize = getPayloadAsBytesUnchecked().length;
			int estimatedSize = currentPayloadSize;
			if (propertyName != null && propertyValue != null) {
				estimatedSize += 5; 
				estimatedSize += propertyName.getBytes(getCharacterEncoding()).length;
				int estimatedValueSize = 0;
				if (propertyValue instanceof String || propertyValue instanceof Number) estimatedValueSize = propertyValue.toString().getBytes(getCharacterEncoding()).length;
				estimatedSize += estimatedValueSize;
			}
			return estimatedSize;
		} catch (Exception e) {
			try {
				return getPayloadSize();
			} catch (Exception e1) {
				return 0;
			}
		}
	}
public int estimatePayloadSizeAfterAdding ( String propertyName , Object propertyValue ) { try { int maximumPayloadSize = getMaximumPayloadSize ( ) ; int currentPayloadSize = getPayloadAsBytesUnchecked ( ) . length ; int estimatedSize = currentPayloadSize ; if ( propertyName != null && propertyValue != null ) { estimatedSize += 5 ; estimatedSize += propertyName . getBytes ( getCharacterEncoding ( ) ) . length ; int estimatedValueSize = 0 ; if ( propertyValue instanceof String || propertyValue instanceof Number ) estimatedValueSize = propertyValue . toString ( ) . getBytes ( getCharacterEncoding ( ) ) . length ; estimatedSize += estimatedValueSize ; } return estimatedSize ; } catch ( Exception e ) { try { return getPayloadSize ( ) ; } catch ( Exception e1 ) { return 0 ; } } }
Estimate the size that this payload will take after adding a given property.
Estimate the size that this payload will take after adding a given property .
// "":""