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

at.spardat.xma.serializer.XmaOutput Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

//@(#) $Id: XmaOutput.java 2089 2007-11-28 13:56:13Z s3460 $
package at.spardat.xma.serializer;

import java.io.IOException;

/**
 * This interface provides for transforming various java
 * primitive types to a destination format that is dependent
 * on the class implementing this interface.
 * 
 * @author YSD, 11.02.2005  
 */
public interface XmaOutput {

    /**
     * Outputs a String
     * 
     * @param label short string that describes what the second parameter means;
     *               this string has only descriptive purpose.
     * @param s the String; must not be null
     * @exception NullPointerException if s is null
     */
    public void writeString (String label, String s) throws IOException;
    
    /**
     * Same as writeString, except that s may be null;
     */
    public void writeStringN (String label, String s) throws IOException;
    
    /**
     * Writes an int
     * 
     * @param label short string that describes what the second parameter means;
     *               this string has only descriptive purpose.
     * @param i the int
     */
    public void writeInt (String label, int i) throws IOException;
    
    /**
     * Writes a long
     * 
     * @param label short string that describes what the second parameter means;
     *               this string has only descriptive purpose.
     * @param l the long
     */
    public void writeLong (String label, long l) throws IOException;
    
    /**
     * Writes a short
     * 
     * @param label short string that describes what the second parameter means;
     *               this string has only descriptive purpose.
     * @param s the short
     */
    public void writeShort (String label, int s) throws IOException;
    
    /**
     * Writes a boolean
     * 
     * @param label short string that describes what the second parameter means;
     *               this string has only descriptive purpose.
     * @param b the boolean
     */
    public void writeBoolean (String label, boolean b) throws IOException;
    
    /**
     * Write a byte
     * 
     * @param label short string that describes what the second parameter means;
     *               this string has only descriptive purpose.
     * @param b the byte
     */
    public void writeByte (String label, int b) throws IOException;
    
    /**
     * Write a sequence of bytes that is the output of the same kind of Serializer
     * that is active now, i.e., providing this XmaOutput.
     * 
     * @param bytes   sequence of bytes; must not be null
     */
    public void writeSerializedBytes (String label, byte[] bytes) throws IOException;
    
    /**
     * Writes an Object. Depending on the Serializer implementing XmaOutput, 
     * obj needs to implement further interfaces, i.e., java.io.Serializable
     * for binary format.
     * 
     * @param obj the object to serialize; must not be null
     * @throws IOException
     */
    public void writeObject (String label, Object obj) throws IOException;
    
    /**
     * Indicates that this is executing at the server
     */
    public boolean isAtServer ();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy