DataBufferPassivationHandler.java 1.52 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.service.DataBuffer
 */
package com.adobe.aemfd.docmanager.internal.passivation;

import com.adobe.aemfd.docmanager.internal.io.DataBufferInputStream;
import com.adobe.aemfd.docmanager.internal.source.DataBufferSourceHandler;
import com.adobe.aemfd.docmanager.passivation.AbstractPassivationHandler;
import com.adobe.aemfd.docmanager.passivation.PassivationConnection;
import com.adobe.aemfd.docmanager.passivation.PassivationType;
import com.adobe.aemfd.docmanager.source.DocumentSourceHandler;
import com.adobe.service.DataBuffer;
import java.io.IOException;
import java.io.InputStream;

public class DataBufferPassivationHandler
extends AbstractPassivationHandler {
    private DataBuffer dataBuffer;

    public DataBufferPassivationHandler(DataBuffer dataBuffer) {
        super(false, true, true);
        this.dataBuffer = dataBuffer;
    }

    public PassivationConnection openConnectionForPassivation() throws IOException {
        DataBufferInputStream is = new DataBufferInputStream(this.dataBuffer);
        return new PassivationConnection(is, this.dataBuffer.getBufLength(), this.dataBuffer.getContentType());
    }

    protected DocumentSourceHandler doPassivate(byte[] preBuffer, PassivationConnection conn, long length) throws IOException {
        return new DataBufferSourceHandler(this.dataBuffer, length, conn.getContentType());
    }

    public void release(boolean passivated, PassivationType pType) {
        this.dataBuffer = null;
    }
}