public int length() {
        return copy().buildBytes().length;
    }
Returns the length of payload bytes once marshaled to bytes

@return the length of the payload
src/main/java/com/notnoop/apns/PayloadBuilder.java