"String improperly terminated: " + len); byte[] data = pointerArray[i].getByteArray(0, (int)len);
byte[] getAddress() { return getPointer().getByteArray(8 + (0xFF & sdl_nlen), 0xFF & sdl_alen); } }
@Override public void got_packet(Pointer args, Pointer header, final Pointer packet) { final Timestamp ts = buildTimestamp(header); final int len = pcap_pkthdr.getLen(header); final byte[] ba = packet.getByteArray(0, pcap_pkthdr.getCaplen(header)); try { executor.execute( new Runnable() { @Override public void run() { timestamps.set(ts); originalLengths.set(len); listener.gotPacket( PacketFactories.getFactory(Packet.class, DataLinkType.class) .newInstance(ba, 0, ba.length, dlt)); } }); } catch (Throwable e) { logger.error("The executor has thrown an exception.", e); } } }
@Override public void got_packet(Pointer args, Pointer header, final Pointer packet) { final Timestamp ts = buildTimestamp(header); final int len = pcap_pkthdr.getLen(header); final byte[] ba = packet.getByteArray(0, pcap_pkthdr.getCaplen(header)); try { executor.execute( new Runnable() { @Override public void run() { timestamps.set(ts); originalLengths.set(len); listener.gotPacket(ba); } }); } catch (Throwable e) { logger.error("The executor has thrown an exception.", e); } } }
final int BYTES_PER_ROW = 4; contents += LS + "memory dump" + LS; byte[] buf = getPointer().getByteArray(0, size()); for (int i=0;i < buf.length;i++) { if ((i % BYTES_PER_ROW) == 0) contents += "[";
timestamps.set(buildTimestamp(headerP)); originalLengths.set(pcap_pkthdr.getLen(headerP)); return packet.getByteArray(0, pcap_pkthdr.getCaplen(headerP)); } else { return null;
return dataP.getByteArray(0, pcap_pkthdr.getCaplen(headerP)); case -1: throw new PcapNativeException("Error occurred in pcap_next_ex(): " + getError(), rc);
/** Return whether the given Structure's backing data is identical to * this one, optionally clearing and re-writing native memory before checking. * @param s Structure to compare * @param clear whether to clear native memory * @return equality result */ public boolean dataEquals(Structure s, boolean clear) { if (clear) { s.getPointer().clear(s.size()); s.write(); getPointer().clear(size()); write(); } byte[] data = s.getPointer().getByteArray(0, s.size()); byte[] ref = getPointer().getByteArray(0, size()); if (data.length == ref.length) { for (int i=0;i < data.length;i++) { if (data[i] != ref[i]) { return false; } } return true; } return false; }
/** * Get byte data. * @return * Byte data or null. */ public byte[] getData() { return pbDevSpecificInfo == null ? null : pbDevSpecificInfo.getByteArray(0, dwSize); } }
/** * Get byte data. * @return * Byte data or null. */ public byte[] getData() { return pbEapInfo == null ? null : pbEapInfo.getByteArray(0, dwSizeofEapInfo); } }
/** * Get buffer bytes. * @return * Raw buffer bytes. */ public byte[] getBytes() { return pvBuffer == null ? null : pvBuffer.getByteArray(0, cbBuffer); } }
/** * Get byte data. * @return * Byte data or null. */ public byte[] getData() { return pbData == null ? null : pbData.getByteArray(0, cbData); } }
/** * Get byte data. * @return * Byte data or null. */ public byte[] getData() { return pbData == null ? null : pbData.getByteArray(0, cbData); } }
public String getValue() { try { Pointer pointer = this.getPointer(); if(pointer == null) { return ""; } int stringLength = pointer.getInt(-4); return new String(pointer.getByteArray(0, stringLength), "UTF-16LE"); } catch (UnsupportedEncodingException ex) { throw new RuntimeException("UTF-16LE charset is not supported", ex); } }
private static class MemberOrder { public int first; public int middle; public int last; }
@Override public void play(MediaPlayer mediaPlayer, Pointer samples, int sampleCount, long pts) { // There may be more efficient ways to do this... int bufferSize = sampleCount * BLOCK_SIZE; // You could process these samples in some way before playing them... byte[] data = samples.getByteArray(0, bufferSize); dataLine.write(data, 0, bufferSize); }
@Override public String toString() { if (getPointer() == Pointer.NULL) { return null; } return n2s(getPointer().getByteArray(0L, (int) getPointer().indexOf(0L, (byte) 0))); } }
public ACCESS_ACEStructure(int Mask, byte AceType, byte AceFlags, PSID psid) { super(); this.calculateSize(true); this.AceType = AceType; this.AceFlags = AceFlags; this.AceSize = (short) (super.fieldOffset("SidStart") + psid.getBytes().length); this.psid = psid; this.Mask = Mask; this.SidStart = psid.getPointer().getByteArray(0, SidStart.length); this.allocateMemory(AceSize); write(); }
public void set(S value) { if (isByValue()) { Pointer p = getPointer(); int s = value.size(); p.write(0, value.getPointer().getByteArray(0, s), 0, s); get(); } else { this.value = value; getPointer().setPointer(0, value.getPointer()); } } protected boolean isByValue() {
public void set(U value) { if (isByValue()) { Pointer p = getPointer(); int s = value.size(); p.write(0, value.getPointer().getByteArray(0, s), 0, s); get(); } else { this.value = value; getPointer().setPointer(0, value.getPointer()); } } protected boolean isByValue() {