1 /* |
1 /* |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
26 package com.sun.xml.internal.stream.buffer.stax; |
26 package com.sun.xml.internal.stream.buffer.stax; |
27 |
27 |
28 import com.sun.xml.internal.stream.buffer.AbstractProcessor; |
28 import com.sun.xml.internal.stream.buffer.AbstractProcessor; |
29 import com.sun.xml.internal.stream.buffer.XMLStreamBuffer; |
29 import com.sun.xml.internal.stream.buffer.XMLStreamBuffer; |
30 |
30 |
|
31 import java.io.IOException; |
31 import java.util.Collections; |
32 import java.util.Collections; |
32 import java.util.HashSet; |
33 import java.util.HashSet; |
33 import java.util.Map; |
34 import java.util.Map; |
34 import java.util.Set; |
35 import java.util.Set; |
35 |
36 |
|
37 import com.sun.xml.internal.org.jvnet.staxex.Base64Data; |
36 import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx; |
38 import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx; |
37 |
39 |
38 import javax.xml.stream.XMLStreamException; |
40 import javax.xml.stream.XMLStreamException; |
39 import javax.xml.stream.XMLStreamWriter; |
41 import javax.xml.stream.XMLStreamWriter; |
40 |
42 |
357 writer.writeCharacters(s); |
359 writer.writeCharacters(s); |
358 break; |
360 break; |
359 } |
361 } |
360 case STATE_TEXT_AS_OBJECT: { |
362 case STATE_TEXT_AS_OBJECT: { |
361 final CharSequence c = (CharSequence)readContentObject(); |
363 final CharSequence c = (CharSequence)readContentObject(); |
362 writer.writeCharacters(c.toString()); |
364 if (c instanceof Base64Data) { |
|
365 try { |
|
366 Base64Data bd = (Base64Data)c; |
|
367 bd.writeTo(writer); |
|
368 } catch (IOException e) { |
|
369 throw new XMLStreamException(e); |
|
370 } |
|
371 } else { |
|
372 writer.writeCharacters(c.toString()); |
|
373 } |
363 break; |
374 break; |
364 } |
375 } |
365 case STATE_COMMENT_AS_CHAR_ARRAY_SMALL: { |
376 case STATE_COMMENT_AS_CHAR_ARRAY_SMALL: { |
366 final int length = readStructure(); |
377 final int length = readStructure(); |
367 final int start = readContentCharactersBuffer(length); |
378 final int start = readContentCharactersBuffer(length); |