Topic RSSReading and Writing a ByteString
June 21, 2016
12:39, EEST
12:39, EEST
Bjarne Boström
Moderator
Moderators
Forum Posts: 1068
Member Since:
April 3, 2012
April 3, 2012
OfflineIf the DataType Attribute is a ByteString then from OPC UA’s perspective it is just a series of bytes. It is a scalar type that consists of an array of bytes that can only be Read/Write completely not in parts (similarly as a String is in programming languages a series of characters). An OPC UA ByteString will map to byte[] in Java. Therefore it can be accessed like any other java array e.g. first element
DataValue dv = (from the read call)
byte[] bs = (byte[]) dv.getValue().getValue(); //assuming it is a ByteString
byte element0 = bs[0];
byte[] bs = (byte[]) dv.getValue().getValue(); //assuming it is a ByteString
byte element0 = bs[0];
Please let me know if my interpretation of your question was wrong.
– Bjarne
Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 63
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 100
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 773
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1558
Posts: 6567
Newest Members:
aracelyhaley4, raphaelschonell, Ashmag, kathyreimann56, brittanylemos, dorthycundiff76, PromotionToold, CHHinrichs, rodricklienhop, jose_WanderleiModerators: Jouni Aro: 1039, Pyry: 1, Petri: 1, Bjarne Boström: 1054, Jimmy Ni: 26, Matti Siponen: 359, Lusetti: 0
Administrators: admin: 1
© Simple:Press —

Log In
Register