이미지 인코딩 된 데이터를 보내고 가져 오는 것에 대한 질문이 있습니다. 우선 전 문자열에서 Base64로 인코딩 형식으로 이미지를 가지고,이 문자열은 다음과 같은 값을 갖는다 : ... D/2wBDAA0JCgsKCA0LCgsODg0PEyAVExISEyccHhcgLikxMC4pLSwzOko + MzZ는 ...인코딩 된 문자열의 HTTP 가져 오기/가져 오기
이제 다시 디코딩하고 난 BitmapFactory를 사용하는 경우 수용 할 경우 imageview thats 괜찮아요 괜찮아요.
byte[] bytes= stream.toByteArray();
imagestr=Base64.encodeBytes(bytes).toString();
//If i code below it is working
byte[] decode = Base64.decode(imagestr);
decoded = BitmapFactory.decodeByteArray(decode, 0, decode.length);
//If i send to the server and handle it in servlet file
String pic = request.getParameter("p");
byte[] servdec = Base64.decode(pic);
//and if i use the servdec to output a image file file is corrupted.
//I noticed the pic and imagestr are different
//imagestr = **...D/2wBDAA0JCgsKCA0LCgsODg0PEyAVExISEyccHhcgLikxMC4pLSwzOko+MzZ...**
//pic = **...D/2wBDAA0JCgsKCA0LCgsODg0PEyAVExISEyccHhcgLikxMC4pLSwzOko MzZ...**
//pic has no + sign.
replaceAll을 사용했지만이 경우에만 사용됩니다. 더 많은 prob가 발생할 수 있습니다. 그래서 거기에 어떤 해결책을 당신이 대답을 주셔서 감사 할 수 있습니다 ...
안녕하세요,이 함수 서블릿이이 기능을 서블릿이 처리 한 후이 문자열은 그림이 있습니다 공공 문자열 uuidfaceid (문자열 UUID, 문자열 faceid, 문자열 이름, 문자열 그림) {
URL url = null;
try {
url = new
URL ("HTTP : //"+ Constants.SERVER_NAME + Constants.SERVER_PORT + "/ MeetInTouch/UF"+ " ? uuid = "+ uuid +"& faceid = "+ faceid +"& name = "+ name +"& pic = "+ pic);
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
URLConnection ucon = null;
try {
ucon = url.openConnection();
} catch (IOException e1) {
e1.printStackTrace();
}
try {
ucon.connect();
} catch (IOException e1) {
e1.printStackTrace();
}
탈출에 문제처럼 보이는 : 당신이 할 일은 당신이 Base64로 디코딩하기 전에 다시 인코딩입니다. 전송하기 전에 문자열을 이스케이프 처리해야합니다. 어떻게 처리하는지 보여줍니다. –