-
-
[求助]String fXML = getXml(fbyte);
-
发表于: 2017-11-10 21:38 2253
-
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;
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!