string weclome=""; byte[] data = new byte[1024]; //字符串转byte数组 data = Encoding.ASCII.GetBytes(welcome); //byte[]数组转ASCII字符串 weclome=Encoding.ASCII.GetString(data, 0, data.length)
关于byte[]数组转十六进制字符串: public static String getHexString(byte[] b) throws Exception { String result = ""; for (int i=0; i < b.length; i++) { result += Integer.toString( ( b[i] & 0xff ) + 0x100, 16).substring( 1 ); } return result; } public s
InputStream is = request.getSession().getServletContext().getResourceAsStream("/WEB-INF/swdjzbg.png"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int len = 1024; byte tmp [] = new byte[len]; int i ; while((i=is.read(tmp, 0, len))&
procedure Hex2Png(str: string; out png: TPngObject); var stream: TMemoryStream; begin if not Assigned(png) then png := TPngObject.Create; stream := TMemoryStream.Create; stream.SetSize(Length(str) ); HexToBin(PChar(str), stream.Memory, stream.Size);