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, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.record;
020
021import java.io.IOException;
022import java.util.TreeMap;
023import java.util.ArrayList;
024
025import org.apache.hadoop.classification.InterfaceAudience;
026import org.apache.hadoop.classification.InterfaceStability;
027
028/**
029 * Interface that all the serializers have to implement.
030 * 
031 * @deprecated Replaced by <a href="https://hadoop.apache.org/avro/">Avro</a>.
032 */
033@Deprecated
034@InterfaceAudience.Public
035@InterfaceStability.Stable
036public interface RecordOutput {
037  /**
038   * Write a byte to serialized record.
039   * @param b Byte to be serialized
040   * @param tag Used by tagged serialization formats (such as XML)
041   * @throws IOException Indicates error in serialization
042   */
043  public void writeByte(byte b, String tag) throws IOException;
044  
045  /**
046   * Write a boolean to serialized record.
047   * @param b Boolean to be serialized
048   * @param tag Used by tagged serialization formats (such as XML)
049   * @throws IOException Indicates error in serialization
050   */
051  public void writeBool(boolean b, String tag) throws IOException;
052  
053  /**
054   * Write an integer to serialized record.
055   * @param i Integer to be serialized
056   * @param tag Used by tagged serialization formats (such as XML)
057   * @throws IOException Indicates error in serialization
058   */
059  public void writeInt(int i, String tag) throws IOException;
060  
061  /**
062   * Write a long integer to serialized record.
063   * @param l Long to be serialized
064   * @param tag Used by tagged serialization formats (such as XML)
065   * @throws IOException Indicates error in serialization
066   */
067  public void writeLong(long l, String tag) throws IOException;
068  
069  /**
070   * Write a single-precision float to serialized record.
071   * @param f Float to be serialized
072   * @param tag Used by tagged serialization formats (such as XML)
073   * @throws IOException Indicates error in serialization
074   */
075  public void writeFloat(float f, String tag) throws IOException;
076  
077  /**
078   * Write a double precision floating point number to serialized record.
079   * @param d Double to be serialized
080   * @param tag Used by tagged serialization formats (such as XML)
081   * @throws IOException Indicates error in serialization
082   */
083  public void writeDouble(double d, String tag) throws IOException;
084  
085  /**
086   * Write a unicode string to serialized record.
087   * @param s String to be serialized
088   * @param tag Used by tagged serialization formats (such as XML)
089   * @throws IOException Indicates error in serialization
090   */
091  public void writeString(String s, String tag) throws IOException;
092  
093  /**
094   * Write a buffer to serialized record.
095   * @param buf Buffer to be serialized
096   * @param tag Used by tagged serialization formats (such as XML)
097   * @throws IOException Indicates error in serialization
098   */
099  public void writeBuffer(Buffer buf, String tag)
100    throws IOException;
101  
102  /**
103   * Mark the start of a record to be serialized.
104   * @param r Record to be serialized
105   * @param tag Used by tagged serialization formats (such as XML)
106   * @throws IOException Indicates error in serialization
107   */
108  public void startRecord(Record r, String tag) throws IOException;
109  
110  /**
111   * Mark the end of a serialized record.
112   * @param r Record to be serialized
113   * @param tag Used by tagged serialization formats (such as XML)
114   * @throws IOException Indicates error in serialization
115   */
116  public void endRecord(Record r, String tag) throws IOException;
117  
118  /**
119   * Mark the start of a vector to be serialized.
120   * @param v Vector to be serialized
121   * @param tag Used by tagged serialization formats (such as XML)
122   * @throws IOException Indicates error in serialization
123   */
124  public void startVector(ArrayList v, String tag) throws IOException;
125  
126  /**
127   * Mark the end of a serialized vector.
128   * @param v Vector to be serialized
129   * @param tag Used by tagged serialization formats (such as XML)
130   * @throws IOException Indicates error in serialization
131   */
132  public void endVector(ArrayList v, String tag) throws IOException;
133  
134  /**
135   * Mark the start of a map to be serialized.
136   * @param m Map to be serialized
137   * @param tag Used by tagged serialization formats (such as XML)
138   * @throws IOException Indicates error in serialization
139   */
140  public void startMap(TreeMap m, String tag) throws IOException;
141  
142  /**
143   * Mark the end of a serialized map.
144   * @param m Map to be serialized
145   * @param tag Used by tagged serialization formats (such as XML)
146   * @throws IOException Indicates error in serialization
147   */
148  public void endMap(TreeMap m, String tag) throws IOException;
149}