View Javadoc

1   /*
2      Copyright 2008 Ramon Servadei
3   
4      Licensed under the Apache License, Version 2.0 (the "License");
5      you may not use this file except in compliance with the License.
6      You may obtain a copy of the License at
7   
8          http://www.apache.org/licenses/LICENSE-2.0
9   
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15   */
16  package fulmine.protocol.specification;
17  
18  import fulmine.model.container.IContainer;
19  
20  /**
21   * Writes fulmine delta (FD) protocol frames.
22   * <p>
23   * Please refer to the "Fulmine Delta Transmission Protocol" specification for a
24   * complete description of the fulmine serialisation technique.
25   * 
26   * @see IFrameConstants
27   * @author Ramon Servadei
28   * 
29   */
30  public interface IFrameWriter
31  {
32      /**
33       * Write a container's complete state into an FD frame.
34       * 
35       * @param container
36       *            the container to write as a frame
37       * @return the byte[] for the FD frame representing the state of the
38       *         container
39       */
40      byte[] writeComplete(final IContainer container);
41  
42      /**
43       * Write a container's current state changes into an FD frame.
44       * 
45       * @param container
46       *            the container to write as a frame
47       * @return the byte[] for the FD frame representing the state of the
48       *         container
49       */
50      byte[] write(final IContainer container);
51  
52      /**
53       * Write only a container's meta state into an FD frame. The meta state
54       * includes the current state (active/inactive)
55       * 
56       * @param container
57       *            the container to write
58       * @return the byte[] for the FD frame representing the meta state of the
59       *         container
60       */
61      byte[] writeMeta(final IContainer container);
62  }