Ejemplo n.º 1
0
 public static byte[] bytesFrom(String string) {
   try {
     return Not.nil(string, "string").getBytes(ENC);
   } catch (UnsupportedEncodingException e) {
     throw new Error("Unsupported encoding", e);
   }
 }
Ejemplo n.º 2
0
 public static String stringFrom(byte[] bytes, int offset, int length) {
   try {
     return new String(Not.nil(bytes, "bytes"), offset, length, ENC);
   } catch (UnsupportedEncodingException e) {
     throw new Error("Unsupported encoding", e);
   }
 }
Ejemplo n.º 3
0
 public static byte[] suffix(int offset, byte[] bytes) {
   if (offset < Not.nil(bytes, "bytes").length) {
     byte[] suffix = new byte[bytes.length - offset];
     System.arraycopy(bytes, offset, suffix, 0, suffix.length);
     return suffix;
   }
   return NONE;
 }
Ejemplo n.º 4
0
 public void setAsynchYou(SystemEvents asynch) {
   Not.nil(asynch, "asynch reference");
   if (this.asynch != null) {
     throw new IllegalStateException(this + " already received asynch pointer to itself");
   }
   this.asynch = asynch;
   this.asynch.spool(bundles);
 }
Ejemplo n.º 5
0
 public static byte[] append(byte[] bytes, byte... suffix) {
   return add(Not.nil(bytes, "bytes"), Not.nil(suffix, "suffix"));
 }
Ejemplo n.º 6
0
 public static byte[] prepend(byte[] bytes, byte... prefix) {
   return add(Not.nil(prefix, "prefix"), Not.nil(bytes, "bytes"));
 }
Ejemplo n.º 7
0
 public static String stringFrom(byte[] bytes, int offset) {
   return stringFrom(Not.nil(bytes, "bytes"), offset, bytes.length - offset);
 }
Ejemplo n.º 8
0
 public static String stringFrom(byte[] bytes) {
   return stringFrom(Not.nil(bytes, "bytes"), 0, bytes.length);
 }