Updated version
- Update display on each received packet - Cleaned up layout - Proper handling of signs for register display
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package de.rumpold.androiddsky.util;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* Created by Adriano on 11.06.2017.
|
||||
*/
|
||||
|
||||
public class BufferUtils {
|
||||
private static void printBuffer(String tag, ByteBuffer buf) {
|
||||
buf.rewind();
|
||||
int index = 0;
|
||||
while (buf.remaining() > 0) {
|
||||
++index;
|
||||
final int b = (int) buf.get();
|
||||
if (b == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final String bitString = StringUtils.leftPad(Integer.toBinaryString(b), 32, '0').substring(24);
|
||||
Log.d(tag, "printBuffer: " + index + ": " + bitString);
|
||||
}
|
||||
Log.d(tag, "--------------------------------------------------");
|
||||
|
||||
buf.rewind();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user