public static byte[] bytesFrom(String string) { try { return Not.nil(string, "string").getBytes(ENC); } catch (UnsupportedEncodingException e) { throw new Error("Unsupported encoding", e); } }
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); } }
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; }
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); }
public static byte[] append(byte[] bytes, byte... suffix) { return add(Not.nil(bytes, "bytes"), Not.nil(suffix, "suffix")); }
public static byte[] prepend(byte[] bytes, byte... prefix) { return add(Not.nil(prefix, "prefix"), Not.nil(bytes, "bytes")); }
public static String stringFrom(byte[] bytes, int offset) { return stringFrom(Not.nil(bytes, "bytes"), offset, bytes.length - offset); }
public static String stringFrom(byte[] bytes) { return stringFrom(Not.nil(bytes, "bytes"), 0, bytes.length); }