Пример #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);
   }
 }
Пример #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);
   }
 }
Пример #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;
 }
Пример #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);
 }
Пример #5
0
 public static byte[] append(byte[] bytes, byte... suffix) {
   return add(Not.nil(bytes, "bytes"), Not.nil(suffix, "suffix"));
 }
Пример #6
0
 public static byte[] prepend(byte[] bytes, byte... prefix) {
   return add(Not.nil(prefix, "prefix"), Not.nil(bytes, "bytes"));
 }
Пример #7
0
 public static String stringFrom(byte[] bytes, int offset) {
   return stringFrom(Not.nil(bytes, "bytes"), offset, bytes.length - offset);
 }
Пример #8
0
 public static String stringFrom(byte[] bytes) {
   return stringFrom(Not.nil(bytes, "bytes"), 0, bytes.length);
 }