public static String readNullTermString(ByteBuffer buffer, Charset charset) { ByteBuffer fork = buffer.duplicate(); while (buffer.hasRemaining() && buffer.get() != 0) ; if (buffer.hasRemaining()) fork.limit(buffer.position() - 1); return new String(toArray(fork), charset); }
public static void write(ByteBuffer to, ByteBuffer from, int count) { if (from.hasArray()) { to.put(from.array(), from.arrayOffset() + from.position(), Math.min(from.remaining(), count)); } else { to.put(toArray(from, count)); } }
public static String readNullTermString(ByteBuffer buffer, Charset charset) { ByteBuffer fork = buffer.duplicate(); while (buffer.hasRemaining() && buffer.get() != 0) ; if (buffer.hasRemaining()) fork.limit(buffer.position() - 1); return new String(toArray(fork), charset); }
public static void write(ByteBuffer to, ByteBuffer from, int count) { if (from.hasArray()) { to.put(from.array(), from.arrayOffset() + from.position(), Math.min(from.remaining(), count)); } else { to.put(toArray(from, count)); } }
public static void write(ByteBuffer to, ByteBuffer from) { if (from.hasArray()) { to.put(from.array(), from.arrayOffset() + from.position(), Math.min(to.remaining(), from.remaining())); } else { to.put(toArray(from, to.remaining())); } }
public static void write(ByteBuffer to, ByteBuffer from) { if (from.hasArray()) { to.put(from.array(), from.arrayOffset() + from.position(), Math.min(to.remaining(), from.remaining())); } else { to.put(toArray(from, to.remaining())); } }
public static String readString(ByteBuffer buffer, int len) { return new String(toArray(read(buffer, len))); }
public static String readString(ByteBuffer buffer, int len) { return new String(toArray(read(buffer, len))); }
public static String readPascalString(ByteBuffer buffer, int maxLen) { ByteBuffer sub = read(buffer, maxLen + 1); return new String(toArray(NIOUtils.read(sub, Math.min(sub.get() & 0xff, maxLen)))); }
public static String readPascalString(ByteBuffer buffer, int maxLen) { ByteBuffer sub = read(buffer, maxLen + 1); return new String(toArray(NIOUtils.read(sub, Math.min(sub.get() & 0xff, maxLen)))); }
break; int len = is.getShort(); byte[] bs = NIOUtils.toArray(NIOUtils.read(is, (len + 1) & 0xfffffffe)); if (bs == null) break;
break; int len = is.getShort(); byte[] bs = NIOUtils.toArray(NIOUtils.read(is, (len + 1) & 0xfffffffe)); if (bs == null) break;
obj = NIOUtils.toArray((ByteBuffer) obj);
obj = NIOUtils.toArray((ByteBuffer) obj);