001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020 package org.apache.directory.shared.asn1.codec.stateful; 021 022 023 import org.apache.directory.shared.asn1.codec.EncoderException; 024 025 026 /** 027 * The StatefulEncoder interface. 028 * 029 * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a> 030 * @version $Rev: 664290 $, $Date: 2008-06-07 08:28:06 +0200 (Sat, 07 Jun 2008) $ 031 */ 032 public interface StatefulEncoder 033 { 034 /** 035 * Encodes a Message object piece by piece often emitting chunks of the 036 * final PDU to the callback if present. 037 * 038 * @param obj the message object to encode into a PDU 039 * @throws EncoderException if there are problems while encoding 040 */ 041 void encode( Object obj ) throws EncoderException; 042 043 044 /** 045 * Sets the callback of the underlying implementation. There is no need for 046 * any special callbacks because when encoding we do not need to transform 047 * before a value return as we did in the decoder. 048 * 049 * @param cb the callback to set on the underlying provider specific encoder 050 */ 051 void setCallback( EncoderCallback cb ); 052 053 054 /** 055 * Sets the monitor of the underlying implementation. 056 * 057 * @param monitor the monitor to set on the underlying implementation 058 */ 059 void setEncoderMonitor( EncoderMonitor monitor ); 060 061 }