📄 hexdumputil.java
字号:
/**
* IgaLib -> String
* Copyright (C) 2001 Tosiki IGA , IgaLib project member
* (http://homepage2.nifty.com/igat/igapyon/index.html)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package jp.ne.nifty.iga.tosiki.string;
import java.io.*;
/**
* 16恑僟儞僾傪峴偆儐乕僥傿儕僥傿僋儔僗<BR>
* 奐敪傪峴偭偰偄傞偲 晄堄偵偁傞僨乕僞傪16恑僟儞僾偟偨偔側傝傑偡丅
* 偙偺僋儔僗偼 偦偺傛偆側16恑僟儞僾傪峴偆僋儔僗偱偡丅
* 側偍 僟儞僾弌椡偦偺傕偺偼 亀柍憰忺亁 偱峴偄傑偡丅
*
* @author Tosiki IGA , Eiichirou Takahashi
*/
public class HexDumpUtil
{
/**
* 梌偊傜傟偨暥帤楍傪16恑僟儞僾暥帤楍壔偟傑偡丅
*
* @param String strDump 僟儞僾偟偨偄暥帤楍
* @return String 16恑壔偝傟偨僟儞僾暥帤楍
*/
public static final String toString(String strDump)
{
try{
StringWriter writerBuf=new StringWriter();
HexDumpWriter writer=new HexDumpWriter(writerBuf);
writer.write(strDump);
writer.flush();
writer.close();
return writerBuf.toString();
}catch(IOException ex){
System.out.println(ex.toString());
ex.printStackTrace();
return null;
}
}
/**
* 梌偊傜傟偨暥帤楍傪16恑僟儞僾暥帤楍壔偟傑偡丅
*
* @param byte[] bytearyDump 僟儞僾偟偨偄byte攝楍
* @return String 16恑壔偝傟偨僟儞僾暥帤楍
*/
public static final String toString(byte[] bytearyDump)
{
try{
StringWriter writerBuf=new StringWriter();
HexDumpWriter writer=new HexDumpWriter(writerBuf);
writer.write(bytearyDump);
writer.flush();
writer.close();
return writerBuf.toString();
}catch(IOException ex){
System.out.println(ex.toString());
ex.printStackTrace();
return null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -