AtomicLong contentSize = new AtomicLong();
if (source.getCharacterStream() != null) {
reader = new SizeMeasuringReader(source.getCharacterStream(), contentSize);
source = new InputSource(reader);
} else {
stream = new SizeMeasuringInputStream(source.getByteStream(), contentSize);
source = new InputSource(stream);
}
// Parse the WSDL, measuring the number of bytes as we read ...
T result = parse(source);