簡體   English   中英

如何解碼GSA資訊提供中的base64compressed項目

[英]How do I decode the base64compressed item in a GSA feed

我擁有供稿發送到Search Appliance進行索引的內容,但是一個XML節點已進行base64壓縮。 查看GSA文檔的自定義供稿是通過壓縮(zlib)然后對其進行編碼來構造的。 我嘗試通過解碼來反轉該過程,然后使用7zip將其打開,但是沒有用。

原理:我認為這是因為GSA是EOL,我們正在轉向Solr,但暫時仍將繼續使用某些GSA連接器(它們是開源的)。 我需要查看被索引到Search Appliance的內容的文本內容,以便構建適當的Solr模式。

我在GSA方面的經驗非常有限,因此我可能會考慮所有這些錯誤,希望對如何解決此問題提出任何建議。

謝謝!

此代碼將解碼,然后解壓縮GSA Feed中的base64compressed項目。

    private byte[] decodeUncompress(byte[] data) throws IOException {
        // Decode
        byte[] decodedBytes = Base64.getDecoder().decode(data);

        // Uncompress
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        Inflater decompresser = new Inflater(false);
        InflaterOutputStream inflaterOutputStream = new InflaterOutputStream(stream, decompresser);
        try {
            inflaterOutputStream.write(decodedBytes);

        } catch (IOException e) {
            throw e;
        } finally {
            try {
                inflaterOutputStream.close();
            } catch (IOException e) {
            }
        }
        return stream.toByteArray();
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM