All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.imapnio.async.request.ImapRequestAdapter Maven / Gradle / Ivy

The newest version!
package com.yahoo.imapnio.async.request;

import java.nio.charset.StandardCharsets;
import java.util.concurrent.ConcurrentLinkedQueue;

import javax.annotation.Nonnull;

import com.sun.mail.imap.protocol.IMAPResponse;
import com.yahoo.imapnio.async.exception.ImapAsyncClientException;
import com.yahoo.imapnio.async.exception.ImapAsyncClientException.FailureType;

import io.netty.buffer.ByteBuf;

/**
 * This class is an adapter for commands with no continuation request or terminal request.
 */
public abstract class ImapRequestAdapter implements ImapRequest {

    @Override
    public boolean isCommandLineDataSensitive() {
        return false;
    }

    @Override
    public String getCommandLine() throws ImapAsyncClientException {
        return getCommandLineBytes().toString(StandardCharsets.US_ASCII);
    }

    @Override
    public String getDebugData() {
        return null;
    }

    @Override
    public ConcurrentLinkedQueue getStreamingResponsesQueue() {
        return null;
    }

    @Override
    public ByteBuf getNextCommandLineAfterContinuation(@Nonnull final IMAPResponse serverResponse) throws ImapAsyncClientException {
        throw new ImapAsyncClientException(FailureType.OPERATION_NOT_SUPPORTED_FOR_COMMAND);
    }

    @Override
    public ByteBuf getTerminateCommandLine() throws ImapAsyncClientException {
        throw new ImapAsyncClientException(FailureType.OPERATION_NOT_SUPPORTED_FOR_COMMAND);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy