View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership. The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License. You may obtain a copy of the License at
9    * 
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   * 
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.apache.river.discovery;
20  
21  import java.io.IOException;
22  import java.nio.ByteBuffer;
23  import net.jini.core.constraint.InvocationConstraints;
24  import net.jini.io.UnsupportedConstraintException;
25  
26  /**
27   * Interface implemented by classes which decode multicast announcement data
28   * according to discovery protocol formats.
29   *
30   * @author Sun Microsystems, Inc.
31   * @since 2.0
32   */
33  public interface MulticastAnnouncementDecoder extends DiscoveryFormatProvider {
34  
35      /**
36       * Decodes the multicast announcement data contained in the given buffer in
37       * a manner that satisfies the specified absolute constraints, returning a
38       * {@link MulticastAnnouncement} instance that contains the decoded data.
39       * <code>null</code> constraints are considered equivalent to empty
40       * constraints.  All the specified constraints are checked before this
41       * method returns.
42       *
43       * @param buf a buffer containing the packet data to decode.  The
44       * multicast announcement data must begin at position zero of
45       * <code>buf</code>.
46       * @param constraints the constraints to apply when decoding the data, or
47       * <code>null</code>
48       * @return the decoded multicast announcement data
49       * @throws IOException if an error occurs in interpreting the data
50       * @throws UnsupportedConstraintException if unable to satisfy the
51       * specified constraints
52       * @throws SecurityException if the given constraints cannot be satisfied
53       * due to insufficient caller permissions
54       * @throws NullPointerException if <code>buf</code> is <code>null</code>
55       */
56      MulticastAnnouncement decodeMulticastAnnouncement(
57  					    ByteBuffer buf,
58  					    InvocationConstraints constraints)
59  	throws IOException;
60  }