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

org.snmp4j.asn1.BERSerializable Maven / Gradle / Ivy

There is a newer version: 3.7.8_1
Show newest version
/*_############################################################################
  _## 
  _##  SNMP4J - BERSerializable.java  
  _## 
  _##  Copyright (C) 2003-2022  Frank Fock (SNMP4J.org)
  _##  
  _##  Licensed under the Apache License, Version 2.0 (the "License");
  _##  you may not use this file except in compliance with the License.
  _##  You may obtain a copy of the License at
  _##  
  _##      http://www.apache.org/licenses/LICENSE-2.0
  _##  
  _##  Unless required by applicable law or agreed to in writing, software
  _##  distributed under the License is distributed on an "AS IS" BASIS,
  _##  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  _##  See the License for the specific language governing permissions and
  _##  limitations under the License.
  _##  
  _##########################################################################*/
package org.snmp4j.asn1;

import java.io.*;

/**
 * The interface BERSerializable has to be implemented by
 * any data type class that needs to be serialized using the Basic Encoding
 * Rules (BER) that provides enconding rules for ASN.1 data types.
 *
 * @author Frank Fock
 * @author Jochen Katz
 * @version 1.0
 */
public interface BERSerializable /*extends Serializable*/ {

  /**
   * Returns the length of this BERSerializable object
   * in bytes when encoded according to the Basic Encoding Rules (BER).
   * @return
   *    the BER encoded length of this variable.
   */
  int getBERLength();

  /**
   * Returns the length of the payload of this BERSerializable object
   * in bytes when encoded according to the Basic Encoding Rules (BER).
   * @return
   *    the BER encoded length of this variable.
   */
  int getBERPayloadLength();

  /**
   * Decodes a Variable from an InputStream.
   * @param inputStream
   *    an InputStream containing a BER encoded byte stream.
   * @throws IOException
   *    if the stream could not be decoded by using BER rules.
   */
  void decodeBER(BERInputStream inputStream) throws IOException;

  /**
   * Encodes a Variable to an OutputStream.
   * @param outputStream
   *    an OutputStream.
   * @throws IOException
   *    if an error occurs while writing to the stream.
   */
  void encodeBER(OutputStream outputStream) throws IOException;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy