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;
022
023import org.apache.hadoop.classification.InterfaceAudience;
024import org.apache.hadoop.classification.InterfaceStability;
025
026/**
027 * Interface that all the Deserializers have to implement.
028 * 
029 * @deprecated Replaced by <a href="http://hadoop.apache.org/avro/">Avro</a>.
030 */
031@Deprecated
032@InterfaceAudience.Public
033@InterfaceStability.Stable
034public interface RecordInput {
035  /**
036   * Read a byte from serialized record.
037   * @param tag Used by tagged serialization formats (such as XML)
038   * @return value read from serialized record.
039   */
040  byte readByte(String tag) throws IOException;
041  
042  /**
043   * Read a boolean from serialized record.
044   * @param tag Used by tagged serialization formats (such as XML)
045   * @return value read from serialized record.
046   */
047  boolean readBool(String tag) throws IOException;
048  
049  /**
050   * Read an integer from serialized record.
051   * @param tag Used by tagged serialization formats (such as XML)
052   * @return value read from serialized record.
053   */
054  int readInt(String tag) throws IOException;
055  
056  /**
057   * Read a long integer from serialized record.
058   * @param tag Used by tagged serialization formats (such as XML)
059   * @return value read from serialized record.
060   */
061  long readLong(String tag) throws IOException;
062  
063  /**
064   * Read a single-precision float from serialized record.
065   * @param tag Used by tagged serialization formats (such as XML)
066   * @return value read from serialized record.
067   */
068  float readFloat(String tag) throws IOException;
069  
070  /**
071   * Read a double-precision number from serialized record.
072   * @param tag Used by tagged serialization formats (such as XML)
073   * @return value read from serialized record.
074   */
075  double readDouble(String tag) throws IOException;
076  
077  /**
078   * Read a UTF-8 encoded string from serialized record.
079   * @param tag Used by tagged serialization formats (such as XML)
080   * @return value read from serialized record.
081   */
082  String readString(String tag) throws IOException;
083  
084  /**
085   * Read byte array from serialized record.
086   * @param tag Used by tagged serialization formats (such as XML)
087   * @return value read from serialized record.
088   */
089  Buffer readBuffer(String tag) throws IOException;
090  
091  /**
092   * Check the mark for start of the serialized record.
093   * @param tag Used by tagged serialization formats (such as XML)
094   */
095  void startRecord(String tag) throws IOException;
096  
097  /**
098   * Check the mark for end of the serialized record.
099   * @param tag Used by tagged serialization formats (such as XML)
100   */
101  void endRecord(String tag) throws IOException;
102  
103  /**
104   * Check the mark for start of the serialized vector.
105   * @param tag Used by tagged serialization formats (such as XML)
106   * @return Index that is used to count the number of elements.
107   */
108  Index startVector(String tag) throws IOException;
109  
110  /**
111   * Check the mark for end of the serialized vector.
112   * @param tag Used by tagged serialization formats (such as XML)
113   */
114  void endVector(String tag) throws IOException;
115  
116  /**
117   * Check the mark for start of the serialized map.
118   * @param tag Used by tagged serialization formats (such as XML)
119   * @return Index that is used to count the number of map entries.
120   */
121  Index startMap(String tag) throws IOException;
122  
123  /**
124   * Check the mark for end of the serialized map.
125   * @param tag Used by tagged serialization formats (such as XML)
126   */
127  void endMap(String tag) throws IOException;
128}