Skip to content
Snippets Groups Projects
Select Git revision
  • 1fa7d17b76d613faa229050eb076ef184de07156
  • main default protected
  • libquassel-migration
  • wip
  • ChenZhangg-Modify_GRADLE_1
  • jetpack-compose-rewrite
  • demo-jump-in-history
  • attachments
  • 1.7.0 protected
  • 1.6.2 protected
  • 1.6.1 protected
  • 1.6.0 protected
  • 1.5.3 protected
  • 1.5.2 protected
  • 1.5.1 protected
  • 1.5.0 protected
  • 1.4.4 protected
  • 1.4.3 protected
  • 1.4.2 protected
  • 1.4.1 protected
  • 1.4.0 protected
  • v1.3.3 protected
  • v1.3.2 protected
  • v1.3.1 protected
  • v1.3.0 protected
  • v1.2.28 protected
  • v1.2.27 protected
  • v1.2.26 protected
28 results

Helper.java

Blame
  • Helper.java 868 B
    package de.kuschku.util.niohelpers;
    
    public class Helper {
        // Making default constructor invisible
        private Helper() {
    
        }
    
        public static void printHexDump(byte[] data) {
            System.out.println("Hexdump following: ");
            String bytes = "";
            String text = "";
            int i;
            for (i = 0; i < data.length; i++) {
                bytes += String.format("%02x ", data[i]);
                text += encodeChar(data[1]);
                if (i > 0 && (i + 1) % 8 == 0) {
                    System.out.println(String.format("%08x ", i - 7) + bytes + text);
                    bytes = "";
                    text = "";
                }
            }
            System.out.println(String.format("%08x ", i - 7) + bytes + text);
        }
    
        private static char encodeChar(byte data) {
            if (data < 127 && data > 32) return (char) data;
            else return '.';
        }
    }