@@ -0,0 +1,1613 @@
+package org.verapdf.model.impl.pb.cos;%0A%0Aimport org.apache.log4j.Logger;%0Aimport org.apache.pdfbox.cos.COSName;%0Aimport org.verapdf.model.coslayer.CosUnicodeName;%0A%0Aimport java.io.UnsupportedEncodingException;%0Aimport java.nio.ByteBuffer;%0Aimport java.nio.charset.CharacterCodingException;%0Aimport java.nio.charset.Charset;%0Aimport java.nio.charset.CharsetDecoder;%0A%0A/**%0A * Implementation of Unicode name%0A *%0A * @author Evgeniy Muravitskiy%0A */%0Apublic class PBCosUnicodeName extends PBCosName implements CosUnicodeName %7B%0A%0A%09public static final Logger LOGGER = Logger.getLogger(PBCosUnicodeName.class);%0A%0A%09public static final String COS_UNICODE_NAME_TYPE = %22CosUnicodeName%22;%0A%0A%09/**%0A%09 * Default constructor.%0A%09 *%0A%09 * @param cosName Apache pdfbox%0A%09 */%0A%09public PBCosUnicodeName(COSName cosName) %7B%0A%09%09super(cosName, COS_UNICODE_NAME_TYPE);%0A%09%7D%0A%0A%09/**%0A%09 * @return true if name is valid UTF-8 string%0A%09 */%0A%09@Override%0A%09public Boolean getisValidUtf8() %7B%0A%09%09String name = ((COSName) this.baseObject).getName();%0A%09%09CharsetDecoder charsetDecoder = Charset.forName(%22UTF-8%22).newDecoder();%0A%09%09ByteBuffer wrap = ByteBuffer.wrap(name.getBytes());%0A%09%09try %7B%0A%09%09%09charsetDecoder.decode(wrap);%0A%09%09%09return Boolean.TRUE;%0A%09%09%7D catch (CharacterCodingException e) %7B%0A%09%09%09return Boolean.FALSE;%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * @return converted to UTF-8 name%0A%09 */%0A%09@Override%0A%09public String getunicodeValue() %7B%0A%09%09String name = ((COSName) this.baseObject).getName();%0A%09%09byte%5B%5D bytes = name.getBytes();%0A%09%09try %7B%0A%09%09%09return new String(bytes, %22UTF-8%22);%0A%09%09%7D catch (UnsupportedEncodingException e) %7B%0A%09%09%09LOGGER.warn(%22Can not transform %22 + name + %22 to unicode string.%22);%0A%09%09%09return null;%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Implement CosUnicodeName type