1 18 19 20 package sync4j.framework.core; 21 22 import sync4j.framework.tools.Base64; 23 24 32 public final class NextNonce 33 implements java.io.Serializable { 34 35 37 private byte[] value; 38 39 43 protected NextNonce() { 44 setValue(new byte[0]); 45 } 46 47 53 public NextNonce(final byte[] value) { 54 setValue(value); 55 } 56 57 63 public NextNonce(final String value) { 64 setValueAsString(value); 65 } 66 67 69 74 public byte[] getValue() { 75 return this.value; 76 } 77 78 public void setValue(final byte[] value) { 79 if (value == null) { 80 this.value = new byte[0]; 81 return; 82 } 83 84 this.value = value; 85 } 86 87 public void setValueAsString(final String value) { 88 if (value == null) { 89 this.value = new byte[0]; 90 return; 91 } 92 93 this.value = value.getBytes(); 94 } 95 96 101 public String getValueAsBase64() { 102 return new String (Base64.encode(value)); 103 } 104 105 public String toString() { 106 return getValueAsBase64(); 107 } 108 } 109 | Popular Tags |