Commit 54c7ec801a393349783dd89fa92b66113e46feb3

Authored by Mickael Boiziot
1 parent 1e34598b
Exists in master and in 1 other branch b6.0.X

Allow to parse floatComplex and doubleComplex datatype

src/main/java/eu/omp/irap/vespa/votable/votabledata/BinaryStreamParser.java
... ... @@ -281,6 +281,42 @@ public final class BinaryStreamParser implements DataParser {
281 281 } else {
282 282 dataBlock = stream.getDouble();
283 283 }
  284 + } else if (dataType.equals(DataType.FLOAT_COMPLEX)) {
  285 + if (rowSize != blockSize) {
  286 + int nb = rowSize / blockSize;
  287 + if (nb == 0) { dataBlock = ""; }
  288 + else {
  289 + StringJoiner sj = new StringJoiner(" ", "", "");
  290 + for (int i = 0; i < nb; i++) {
  291 + sj.add(String.valueOf(stream.getFloat()));
  292 + sj.add(String.valueOf(stream.getFloat()));
  293 + }
  294 + dataBlock = sj.toString();
  295 + }
  296 + } else {
  297 + StringJoiner sj = new StringJoiner(" ", "", "");
  298 + sj.add(String.valueOf(stream.getFloat()));
  299 + sj.add(String.valueOf(stream.getFloat()));
  300 + dataBlock = sj.toString();
  301 + }
  302 + } else if (dataType.equals(DataType.DOUBLE_COMPLEX)) {
  303 + if (rowSize != blockSize) {
  304 + int nb = rowSize / blockSize;
  305 + if (nb == 0) { dataBlock = ""; }
  306 + else {
  307 + StringJoiner sj = new StringJoiner(" ", "", "");
  308 + for (int i = 0; i < nb; i++) {
  309 + sj.add(String.valueOf(stream.getDouble()));
  310 + sj.add(String.valueOf(stream.getDouble()));
  311 + }
  312 + dataBlock = sj.toString();
  313 + }
  314 + } else {
  315 + StringJoiner sj = new StringJoiner(" ", "", "");
  316 + sj.add(String.valueOf(stream.getDouble()));
  317 + sj.add(String.valueOf(stream.getDouble()));
  318 + dataBlock = sj.toString();
  319 + }
284 320 } else {
285 321 BinaryStreamParser.LOGGER.warning("Data type " + dataType + " is not supported.");
286 322 dataBlock = null;
... ...