1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2013, 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 |
38 import com.sun.xml.internal.ws.encoding.ContentTypeImpl; |
38 import com.sun.xml.internal.ws.encoding.ContentTypeImpl; |
39 import java.io.BufferedInputStream; |
39 import java.io.BufferedInputStream; |
40 |
40 |
41 import javax.xml.stream.XMLStreamException; |
41 import javax.xml.stream.XMLStreamException; |
42 import javax.xml.stream.XMLStreamWriter; |
42 import javax.xml.stream.XMLStreamWriter; |
43 import javax.xml.stream.XMLStreamReader; |
|
44 import javax.xml.ws.WebServiceException; |
43 import javax.xml.ws.WebServiceException; |
45 import java.io.OutputStream; |
44 import java.io.OutputStream; |
46 import java.io.InputStream; |
45 import java.io.InputStream; |
47 import java.io.IOException; |
46 import java.io.IOException; |
48 import java.nio.channels.WritableByteChannel; |
47 import java.nio.channels.WritableByteChannel; |
108 } |
107 } |
109 |
108 |
110 public void decode(InputStream in, String contentType, Packet packet) throws IOException { |
109 public void decode(InputStream in, String contentType, Packet packet) throws IOException { |
111 /* Implements similar logic as the XMLMessage.create(String, InputStream). |
110 /* Implements similar logic as the XMLMessage.create(String, InputStream). |
112 * But it's faster, as we know the InputStream has FastInfoset content*/ |
111 * But it's faster, as we know the InputStream has FastInfoset content*/ |
113 Message message = null; |
112 Message message; |
114 in = hasSomeData(in); |
113 in = hasSomeData(in); |
115 if (in != null) { |
114 if (in != null) { |
116 message = Messages.createUsingPayload(new FastInfosetSource(in), |
115 message = Messages.createUsingPayload(new FastInfosetSource(in), |
117 SOAPVersion.SOAP_11); |
116 SOAPVersion.SOAP_11); |
118 } else { |
117 } else { |
130 if (_serializer != null) { |
129 if (_serializer != null) { |
131 _serializer.setOutputStream(out); |
130 _serializer.setOutputStream(out); |
132 return _serializer; |
131 return _serializer; |
133 } else { |
132 } else { |
134 return _serializer = createNewStreamWriter(out, _retainState); |
133 return _serializer = createNewStreamWriter(out, _retainState); |
135 } |
|
136 } |
|
137 |
|
138 private XMLStreamReader getXMLStreamReader(InputStream in) { |
|
139 if (_parser != null) { |
|
140 _parser.setInputStream(in); |
|
141 return _parser; |
|
142 } else { |
|
143 return _parser = createNewStreamReader(in, _retainState); |
|
144 } |
134 } |
145 } |
135 } |
146 |
136 |
147 /** |
137 /** |
148 * Creates a new {@link FastInfosetCodec} instance. |
138 * Creates a new {@link FastInfosetCodec} instance. |