Revision 1915 trunk/libraries/libIverUtiles/src/com/iver/utiles/XMLEntity.java

View differences:

XMLEntity.java
519 519

  
520 520
		return ret;
521 521
	}
522
	/**
523
	 * Devuelve el array de bytes que corresponda a la clave que se pasa como
524
	 * par?metro.
525
	 *
526
	 * @param key clave
527
	 *
528
	 * @return valor.
529
	 *
530
	 * @throws NotExistInXMLEntity Lanza esta excepci?n si no se encuentra
531
	 * 		   ning?n elemento con esa clave.
532
	 */
533
	public byte[] getByteArrayProperty(String key) {
534
		Property[] properties = xmltag.getProperty();
535
		String value = null;
536
		boolean exists = false;
522 537

  
538
		for (int i = 0; i < properties.length; i++) {
539
			if (properties[i].getKey().compareTo(key) == 0) {
540
				value = properties[i].getValue();
541
				exists = true;
542
			}
543
		}
544

  
545
		if (!exists) {
546
			throw new NotExistInXMLEntity();
547
		}
548

  
549
		if (value.compareTo("") == 0) {
550
			return new byte[0];
551
		}
552

  
553
		String[] aux = (String[]) value.split(" ,");
554
		byte[] ret = new byte[aux.length];
555

  
556
		for (int i = 0; i < aux.length; i++) {
557
			ret[i] = Byte.parseByte(aux[i].replaceAll("\\\\,", ","));
558
		}
559

  
560
		return ret;
561
	}
562

  
523 563
	/**
524 564
	 * Devuelve el array de enteros que corresponda a la clave que se pasa como
525 565
	 * par?metro.

Also available in: Unified diff