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);
            }
        }
    }
    

    结果

  • 相关阅读:
    记计账需求分析
    进度条07
    Runner站立会议03
    Runner站立会议02
    Runner站立会议01
    构建之法阅读笔记03
    团队成员介绍
    团队进展报告(1)
    今日事——Sprint计划会议
    团队开发——软件需求分析报告
  • 原文地址:https://www.cnblogs.com/musea/p/9164739.html
Copyright © 2011-2022 走看看