zoukankan      html  css  js  c++  java
  • myod

    MyOD

    内容

    编写MyOD.java 用java MyOD XXX实现Linux下od -tx -tc XXX的功能

    import java.io.*;
    import java.util.Scanner;
    /**
    *Created by xinag on 2018/6/10.
    */
    public class MyOD {
        public static void dump(InputStream src)
                throws IOException {
            try (InputStream input = src) {
                byte[][] data = new byte[50][1];
                byte[][] transf = new byte[50][1];
                int i=0, j=0, num;
                System.out.print("00010: ");
                while (input.read(data[i]) != -1) {
                    num = (int)data[i][0];
                    System.out.printf("%5s", Integer.toHexString(num));
                    i++;
                }
                System.out.print("
    00020: ");
                while (j<i) {
                    transf[j][0] = (byte)(data[j][0] - 0x30);
                    System.out.printf("%5d", transf[j][0]);
                    j++;
                }
                System.out.println();
            }
        }
        public static void main(String[] args) {
            FileInputStream fis = null;
            Scanner scanner = new Scanner(System.in);
            String adress = null;
            try {
                System.out.println("Input your file adress:");
                adress = scanner.next();
                fis = new FileInputStream(adress);
                dump(fis);
            }catch(Exception e) {
                System.out.println(e);
            }
        }
    }
    

    结果

  • 相关阅读:
    v-model
    CSS background 属性
    渐变背景
    mint ui的field用法和修改样式的方法
    js 数组包含
    password 密码查询
    web 单一平台登录逻辑
    内存共享锁业务逻辑(原创)
    无限分类树操作
    根据日期获取,x岁x月x天
  • 原文地址:https://www.cnblogs.com/musea/p/9164739.html
Copyright © 2011-2022 走看看