blob: ffa89ce274cebb8f4aba4cf7ed4386b3c248b16a [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.apache.ignite.binary;
import java.math.BigDecimal;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
import org.jetbrains.annotations.Nullable;
/**
* Raw writer for binary object. Raw writer does not write field name hash codes, therefore,
* making the format even more compact. However, if the raw writer is used,
* dynamic structure changes to the binary objects are not supported.
*/
public interface BinaryRawWriter {
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeByte(byte val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeShort(short val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeInt(int val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeLong(long val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeFloat(float val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeDouble(double val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeChar(char val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeBoolean(boolean val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeDecimal(@Nullable BigDecimal val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeString(@Nullable String val) throws BinaryObjectException;
/**
* @param val UUID to write.
* @throws BinaryObjectException In case of error.
*/
public void writeUuid(@Nullable UUID val) throws BinaryObjectException;
/**
* @param val Date to write.
* @throws BinaryObjectException In case of error.
*/
public void writeDate(@Nullable Date val) throws BinaryObjectException;
/**
* @param val Timestamp to write.
* @throws BinaryObjectException In case of error.
*/
public void writeTimestamp(@Nullable Timestamp val) throws BinaryObjectException;
/**
* @param val Time to write.
* @throws BinaryObjectException In case of error.
*/
public void writeTime(@Nullable Time val) throws BinaryObjectException;
/**
* @param obj Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeObject(@Nullable Object obj) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeByteArray(@Nullable byte[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeShortArray(@Nullable short[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeIntArray(@Nullable int[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeLongArray(@Nullable long[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeFloatArray(@Nullable float[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeDoubleArray(@Nullable double[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeCharArray(@Nullable char[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeBooleanArray(@Nullable boolean[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeDecimalArray(@Nullable BigDecimal[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeStringArray(@Nullable String[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeUuidArray(@Nullable UUID[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeDateArray(@Nullable Date[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeTimestampArray(@Nullable Timestamp[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeTimeArray(@Nullable Time[] val) throws BinaryObjectException;
/**
* @param val Value to write.
* @throws BinaryObjectException In case of error.
*/
public void writeObjectArray(@Nullable Object[] val) throws BinaryObjectException;
/**
* @param <T> Type of elements in collection to write.
* @param col Collection to write.
* @throws BinaryObjectException In case of error.
*/
public <T> void writeCollection(@Nullable Collection<T> col) throws BinaryObjectException;
/**
* @param <K> Type of keys in the map to write.
* @param <V> Type of mapped values in the map to write.
* @param map Map to write.
* @throws BinaryObjectException In case of error.
*/
public <K, V> void writeMap(@Nullable Map<K, V> map) throws BinaryObjectException;
/**
* @param val Value to write.
* @param <T> Type of the enum to write.
* @throws BinaryObjectException In case of error.
*/
public <T extends Enum<?>> void writeEnum(T val) throws BinaryObjectException;
/**
* @param val Value to write.
* @param <T> Type of the enum values in array to write.
* @throws BinaryObjectException In case of error.
*/
public <T extends Enum<?>> void writeEnumArray(T[] val) throws BinaryObjectException;
}