コード例 #1
0
 private static byte[] decodeBase64(CharSequence text) {
   if (text instanceof Base64Data) {
     Base64Data base64Data = (Base64Data) text;
     return base64Data.getExact();
   } else {
     return DatatypeConverterImpl._parseBase64Binary(text.toString());
   }
 }
コード例 #2
0
  /**
   * Writes the given byte[] as base64 encoded binary to the output.
   *
   * <p>Being defined on this class allows this method to access the buffer directly, which
   * translates to a better performance.
   */
  public void text(byte[] data, int dataLen) throws IOException {
    closeStartTag();

    int start = 0;

    while (dataLen > 0) {
      // how many bytes (in data) can we write without overflowing the buffer?
      int batchSize = Math.min(((octetBuffer.length - octetBufferIndex) / 4) * 3, dataLen);

      // write the batch
      octetBufferIndex =
          DatatypeConverterImpl._printBase64Binary(
              data, start, batchSize, octetBuffer, octetBufferIndex);

      if (batchSize < dataLen) flushBuffer();

      start += batchSize;
      dataLen -= batchSize;
    }
  }
コード例 #3
0
 /*     */ static JaxBeanInfo parseXsiType(
     UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo)
     throws SAXException {
   /*  69 */ UnmarshallingContext context = state.getContext();
   /*  70 */ JaxBeanInfo beanInfo = null;
   /*     */
   /*  73 */ Attributes atts = ea.atts;
   /*  74 */ int idx = atts.getIndex("http://www.w3.org/2001/XMLSchema-instance", "type");
   /*     */
   /*  76 */ if (idx >= 0)
   /*     */ {
     /*  79 */ String value = atts.getValue(idx);
     /*     */
     /*  81 */ QName type = DatatypeConverterImpl._parseQName(value, context);
     /*  82 */ if (type == null) {
       /*  83 */ reportError(Messages.NOT_A_QNAME.format(new Object[] {value}), true);
       /*     */ } else {
       /*  85 */ if ((defaultBeanInfo != null) && (defaultBeanInfo.getTypeNames().contains(type)))
       /*     */ {
         /*  92 */ return defaultBeanInfo;
         /*     */ }
       /*  94 */ beanInfo = context.getJAXBContext().getGlobalType(type);
       /*  95 */ if (beanInfo == null) {
         /*  96 */ String nearest = context.getJAXBContext().getNearestTypeName(type);
         /*  97 */ if (nearest != null)
           /*  98 */ reportError(
               Messages.UNRECOGNIZED_TYPE_NAME_MAYBE.format(new Object[] {type, nearest}), true);
         /*     */ else {
           /* 100 */ reportError(
               Messages.UNRECOGNIZED_TYPE_NAME.format(new Object[] {type}), true);
           /*     */ }
         /*     */
         /*     */ }
       /*     */
       /*     */ }
     /*     */
     /*     */ }
   /*     */
   /* 112 */ return beanInfo;
   /*     */ }
コード例 #4
0
 /*    */ public String print(Object o) /*    */ {
   /* 44 */ return DatatypeConverterImpl._printByte(((Bean) o).get_byte());
   /*    */ }
コード例 #5
0
 /*    */ public void parse(Object o, CharSequence lexical) {
   /* 48 */ ((Bean) o).set_byte(DatatypeConverterImpl._parseByte(lexical));
   /*    */ }
コード例 #6
0
 public void parse(Object o, CharSequence lexical) {
   ((Bean) o).f_float = DatatypeConverterImpl._parseFloat(lexical);
 }
コード例 #7
0
 public String print(Object o) {
   return DatatypeConverterImpl._printFloat(((Bean) o).f_float);
 }