DummyExternalizableUtil.java 6.38 KB
Newer Older
Gaston Dombiak's avatar
Gaston Dombiak committed
1 2 3 4 5 6 7 8 9 10 11 12
/**
 * $RCSfile$
 * $Revision: $
 * $Date: $
 *
 * Copyright (C) 2007 Jive Software. All rights reserved.
 *
 * This software is published under the terms of the GNU Public License (GPL),
 * a copy of which is included in this distribution.
 */
package org.jivesoftware.util.cache;

13
import java.io.*;
Gaston Dombiak's avatar
Gaston Dombiak committed
14
import java.util.*;
Gaston Dombiak's avatar
Gaston Dombiak committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140

/**
 * Dummy implementation that does nothing. The open source version of the server uses this
 * strategy.
 *
 * @author Gaston Dombiak
 */
public class DummyExternalizableUtil implements ExternalizableUtilStrategy {
    /**
     * Writes a Map of String key and value pairs. This method handles the
     * case when the Map is <tt>null</tt>.
     *
     * @param out       the output stream.
     * @param stringMap the Map of String key/value pairs.
     * @throws java.io.IOException if an error occurs.
     */
    public void writeStringMap(DataOutput out, Map<String, String> stringMap) throws IOException {
        // Do nothing
    }

    /**
     * Reads a Map of String key and value pairs. This method will return
     * <tt>null</tt> if the Map written to the stream was <tt>null</tt>.
     *
     * @param in the input stream.
     * @return a Map of String key/value pairs.
     * @throws IOException if an error occurs.
     */
    public Map<String, String> readStringMap(DataInput in) throws IOException {
        // Do nothing
        return Collections.emptyMap();
    }

    /**
     * Writes a Map of Long key and Integer value pairs. This method handles
     * the case when the Map is <tt>null</tt>.
     *
     * @param out the output stream.
     * @param map the Map of Long key/Integer value pairs.
     * @throws IOException if an error occurs.
     */
    public void writeLongIntMap(DataOutput out, Map<Long, Integer> map) throws IOException {
        // Do nothing
    }

    /**
     * Reads a Map of Long key and Integer value pairs. This method will return
     * <tt>null</tt> if the Map written to the stream was <tt>null</tt>.
     *
     * @param in the input stream.
     * @return a Map of Long key/Integer value pairs.
     * @throws IOException if an error occurs.
     */
    public Map readLongIntMap(DataInput in) throws IOException {
        // Do nothing
        return Collections.emptyMap();
    }

    /**
     * Writes a List of Strings. This method handles the case when the List is
     * <tt>null</tt>.
     *
     * @param out        the output stream.
     * @param stringList the List of Strings.
     * @throws IOException if an error occurs.
     */
    public void writeStringList(DataOutput out, List stringList) throws IOException {
        // Do nothing
    }

    /**
     * Reads a List of Strings. This method will return <tt>null</tt> if the List
     * written to the stream was <tt>null</tt>.
     *
     * @param in the input stream.
     * @return a List of Strings.
     * @throws IOException if an error occurs.
     */
    public List<String> readStringList(DataInput in) throws IOException {
        // Do nothing
        return Collections.emptyList();
    }

    /**
     * Writes an array of long values. This method handles the case when the
     * array is <tt>null</tt>.
     *
     * @param out   the output stream.
     * @param array the array of long values.
     * @throws IOException if an error occurs.
     */
    public void writeLongArray(DataOutput out, long[] array) throws IOException {
        // Do nothing
    }

    /**
     * Reads an array of long values. This method will return <tt>null</tt> if
     * the array written to the stream was <tt>null</tt>.
     *
     * @param in the input stream.
     * @return an array of long values.
     * @throws IOException if an error occurs.
     */
    public long[] readLongArray(DataInput in) throws IOException {
        // Do nothing
        return new long[]{};
    }

    public void writeLong(DataOutput out, long value) {
        // Do nothing
    }

    public long readLong(DataInput in) {
        // Do nothing
        return 0;
    }

    public void writeBoolean(DataOutput out, boolean value) {
        // Do nothing
    }

    public boolean readBoolean(DataInput in) {
        // Do nothing
        return false;
    }

141 142 143 144 145 146 147 148 149
    public void writeByteArray(DataOutput out, byte[] value) throws IOException {
        // Do nothing
    }

    public byte[] readByteArray(DataInput in) throws IOException {
        // Do nothing
        return new byte[0];
    }

150 151 152 153 154 155 156 157 158
    public void writeSerializable(DataOutput out, Serializable value) throws IOException {
        // Do nothing
    }

    public Serializable readSerializable(DataInput in) throws IOException {
        // Do nothing
        return null;
    }

Gaston Dombiak's avatar
Gaston Dombiak committed
159 160 161 162 163 164 165 166
    public void writeSafeUTF(DataOutput out, String value) {
        // Do nothing
    }

    public String readSafeUTF(DataInput in) {
        // Do nothing
        return "";
    }
167 168 169 170 171 172 173 174 175 176 177

    public void writeExternalizableCollection(DataOutput out, Collection<? extends Externalizable> value)
            throws IOException {
        // Do nothing
    }

    public int readExternalizableCollection(DataInput in, Collection<? extends Externalizable> value,
                                            ClassLoader loader) throws IOException {
        // Do nothing
        return 0;
    }
Gaston Dombiak's avatar
Gaston Dombiak committed
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214

    public void writeExternalizableMap(DataOutput out, Map<String, ? extends Externalizable> map) throws IOException {
        // Do nothing
    }

    public int readExternalizableMap(DataInput in, Map<String, ? extends Externalizable> map, ClassLoader loader)
            throws IOException {
        // Do nothing
        return 0;
    }

    public void writeStringsMap(DataOutput out, Map<String, Set<String>> map) throws IOException {
        // Do nothing
    }

    public int readStringsMap(DataInput in, Map<String, Set<String>> map) throws IOException {
        // Do nothing
        return 0;
    }

    public void writeStrings(DataOutput out, Collection<String> collection) throws IOException {
        // Do nothing
    }

    public int readStrings(DataInput in, Collection<String> collection) throws IOException {
        // Do nothing
        return 0;
    }

    public void writeInt(DataOutput out, int value) {
        // Do nothing
    }

    public int readInt(DataInput in) {
        // Do nothing
        return 0;
    }
Gaston Dombiak's avatar
Gaston Dombiak committed
215
}