Behandeln Sie die Oktett-Stream-Antwort PDF in JavaJava

Java-Forum
Anonymous
 Behandeln Sie die Oktett-Stream-Antwort PDF in Java

Post by Anonymous »

Ich rufe die SOAP -API an. Ich bekomme die folgende Antwort. < /P>

Code: Select all

       --uuid:9a919725-1013-42c2-9df9-4e145657ae1e+id=3Content-ID: http://tempuri.org/0Content-Transfer-Encoding: 8bitContent-Type: application/xop+xml;charset=utf-8;type="text/xml"





2022-02-24T16:56:45BATCHB***********UI



--uuid:9a919725-1013-42c2-9df9-4e145657ae1e+id=3Content-ID: http://tempuri.org/1/638744554073071663Content-Transfer-Encoding: binaryContent-Type: application/octet-stream
%PDF-1.4%    4 0 obj>endobj5 0 obj>streamx wTS Ͻ7 P {d+ }….EOF
< /code>
Ich nehme den PDF-Inhalt von % PDF-1,4 % bis EOF auf und kodiert ihn zu Basis 64, aber der Basis-64-Wert generiert nicht die richtige PDF-Datei nach der Codierung.    private static String getpdfDataEncoded(String s, LoggerUtil logger) {
// Find the starting index of "%PDF"
int startIndex = s.indexOf("%PDF");

// Check if "%PDF" is found in the string
String result = null;
if (startIndex != -1) {
// Extract the substring starting from "%PDF"
result = s.substring(startIndex);
logger.info("Extracted substring is created.");
} else {
logger.info("Substring not found.");
}
String encodedString = Base64.getEncoder().encodeToString(result.getBytes());

return encodedString;
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post