All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.refinitiv.eta.codec.FieldEntryImpl Maven / Gradle / Ivy
/*|-----------------------------------------------------------------------------
*| This source code is provided under the Apache 2.0 license --
*| and is provided AS IS with no warranty or guarantee of fit for purpose. --
*| See the project's LICENSE.md for details. --
*| Copyright (C) 2019-2022 Refinitiv. All rights reserved. --
*|-----------------------------------------------------------------------------
*/
package com.refinitiv.eta.codec;
import com.refinitiv.eta.codec.Buffer;
import com.refinitiv.eta.codec.CodecFactory;
import com.refinitiv.eta.codec.DataTypes;
import com.refinitiv.eta.codec.Date;
import com.refinitiv.eta.codec.DateTime;
import com.refinitiv.eta.codec.DecodeIterator;
import com.refinitiv.eta.codec.EncodeIterator;
import com.refinitiv.eta.codec.Enum;
import com.refinitiv.eta.codec.FieldEntry;
import com.refinitiv.eta.codec.Int;
import com.refinitiv.eta.codec.Qos;
import com.refinitiv.eta.codec.Real;
import com.refinitiv.eta.codec.State;
import com.refinitiv.eta.codec.Time;
import com.refinitiv.eta.codec.UInt;
class FieldEntryImpl implements FieldEntry
{
int _fieldId;
int _dataType;
final Buffer _encodedData = CodecFactory.createBuffer();
@Override
public void clear()
{
_fieldId = 0;
_dataType = 0;
_encodedData.clear();
}
@Override
public int encode(EncodeIterator iter)
{
return Encoders.encodeFieldEntry(iter, this, null);
}
@Override
public int encodeBlank(EncodeIterator iter)
{
_encodedData.clear();
return Encoders.encodeFieldEntry(iter, this, null);
}
@Override @Deprecated
public int encode(EncodeIterator iter, Object data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, Int data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, UInt data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, Real data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, Date data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, Time data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, DateTime data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, Qos data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, State data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, Enum data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, Buffer data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, Float data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encode(EncodeIterator iter, Double data)
{
return Encoders.encodeFieldEntry(iter, this, data);
}
@Override
public int encodeInit(EncodeIterator iter, int encodingMaxSize)
{
return Encoders.encodeFieldEntryInit(iter, this, encodingMaxSize);
}
@Override
public int encodeComplete(EncodeIterator iter, boolean success)
{
return Encoders.encodeFieldEntryComplete(iter, success);
}
@Override
public int decode(DecodeIterator iter)
{
return Decoders.decodeFieldEntry(iter, this);
}
@Override
public void fieldId(int fieldId)
{
assert (fieldId >= -32768 && fieldId <= 32767) : "fieldId is out of range (-32768-32767)"; // int16
_fieldId = fieldId;
}
@Override
public int fieldId()
{
return _fieldId;
}
@Override
public void dataType(int dataType)
{
assert (dataType > DataTypes.UNKNOWN && dataType <= DataTypes.LAST) : "dataType is out of range. Refer to DataTypes";
_dataType = dataType;
}
@Override
public int dataType()
{
return _dataType;
}
@Override
public void encodedData(Buffer encodedData)
{
assert (encodedData != null) : "encodedData must be non-null";
((BufferImpl)_encodedData).copyReferences(encodedData);
}
@Override
public Buffer encodedData()
{
return _encodedData;
}
}