Code example for Date

Methods: getTimegetYearsetYear

0
    	 
    	return URLEncoder.encode(new String(Base64.encode(rawHmac, Base64.DEFAULT)).trim());
	} 
	 
	private String buildValidRawToken() throws InvalidKeyException, NoSuchAlgorithmException, IllegalStateException, UnsupportedEncodingException {
		Date d = new Date();
		d.setYear(d.getYear() + 1);
		String token = mRawToken.replace("#EXPIRATION#", new Long(d.getTime() / 1000).toString());
		Integer end = token.indexOf("&HMACSHA256=");
		token = token.replace("#SIGNATURE#", buildSignatureFor(token.substring(0, end)));
		return token;
	} 
 
	private String buildExpiredRawToken() throws InvalidKeyException, NoSuchAlgorithmException, IllegalStateException, UnsupportedEncodingException {
		Date d = new Date();
		d.setYear(d.getYear() - 1);
		String token = mRawToken.replace("#EXPIRATION#", new Long(d.getTime() / 1000).toString());
		Integer end = token.indexOf("&HMACSHA256=");
		token = token.replace("#SIGNATURE#", buildSignatureFor(token.substring(0, end)));
		return token;
	}