二進制照片轉base64

                Blob binPhoto = face.getFacephoto();

                BufferedInputStream binis = new BufferedInputStream(binPhoto.getBinaryStream());

                ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
                byte[] buff = new byte[100];
                int rc = 0;
                while ((rc = binis.read(buff, 0, 100)) > 0) {
                    swapStream.write(buff, 0, rc);
                }

                return Base64.encode(swapStream.toByteArray());


發佈了32 篇原創文章 · 獲贊 2 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章