-
-
[求助]初学XML 转换,怎么去做转换呢?
-
发表于: 2017-11-10 21:34 2971
-
求助:转换文件
public static void main(String[] args) throws Exception
{
fname =“C:\\1.xml”;
byte[] fbyte = readFile(fname);
String fXML = getXml(fbyte);
}
public static byte[] readFile(String aFileName)
{
FileInputStream fio = null;
byte[] abyte0 = (byte[])null;
try
{
fio = new FileInputStream(aFileName);
byte[] ftemp = new byte[8192];
ByteArrayOutputStream fbyteout = new ByteArrayOutputStream(8192);
int flen = 0;
while (flen >= 0)
{
flen = fio.read(ftemp);
if (flen > 0)
fbyteout.write(ftemp, 0, flen);
}
ftemp = fbyteout.toByteArray();
abyte0 = ftemp;
if (fio != null)
fio.close();
} catch (Exception localException) {
}
return abyte0;
}
{
if ((abytes == null) || (abytes.length <= 0))
return null;
byte[] ftemp = new byte[abytes.length];
for (int i = 0; i < ftemp.length; i++) {
ftemp[i] = ((byte)(abytes[i] ^ 0xFFFFFFFF));
}
EncodeBase64 fdecoder = new EncodeBase64();
String result = null;
try
{
result = new String(EncodeBase64.decode(new String(ftemp)), "UTF-8");
}
catch (Exception ex)
{
result = null;
}
return result;
}
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)