andvasp commented on code in PR #2673:
URL: https://github.com/apache/plc4x/pull/2673#discussion_r3731644576
##########
plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/base/EipTcpConnection.java:
##########
@@ -767,12 +765,7 @@ private static byte[] toAnsi(String tag) throws
BufferException {
segments.add(newSegment);
lengthBytes += newSegment.getLengthInBytes();
}
- WriteBufferByteBased buffer = new WriteBufferByteBased(new
byte[lengthBytes],
- WithByteBasedOption.WithByteOrder("LITTLE_ENDIAN"),
- WithOption.WithUnsignedIntegerEncoding("unsigned-binary"),
- WithOption.WithSignedIntegerEncoding("twos-complement"),
- WithOption.WithFloatEncoding("IEEE754"),
Review Comment:
> if you find more places, where I created the buffer manually, I think it
would be good to allways use the
> transportCodec functions for generating them.
I found places using LITTLE_ENDIAN not creating the buffer but ByteBuffer
show below. I do not know if would be a problem.
What do you think?
```java
private byte[] encodeValue(PlcValue value, CIPDataTypeCode type) {
ByteBuffer buffer =
ByteBuffer.allocate(type.getSize()).order(ByteOrder.LITTLE_ENDIAN);
```
```java
private PlcValue parsePlcValue(EipTag tag, byte[] rawData, CIPDataTypeCode
type) {
final int STRING_LEN_OFFSET = 2;
final int STRING_DATA_OFFSET = 6;
ByteBuffer data =
ByteBuffer.wrap(rawData).order(ByteOrder.LITTLE_ENDIAN);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]