use of org.apache.axiom.blob.WritableBlob in project webservices-axiom by apache.
the class PartInputStream method detach.
void detach() throws IOException {
if (blobFactory == null) {
throw new IllegalStateException();
}
if (in != null) {
WritableBlob content = blobFactory.createBlob();
content.readFrom(in);
this.content = content;
in = getInputStream(content);
}
blobFactory = null;
}
use of org.apache.axiom.blob.WritableBlob in project webservices-axiom by apache.
the class BlobOMDataSourceCustomBuilder method create.
@Override
public OMDataSource create(OMElement element) throws OMException {
try {
WritableBlob blob = blobFactory.createBlob();
OutputStream out = blob.getOutputStream();
try {
element.serializeAndConsume(out);
} finally {
out.close();
}
return new BlobOMDataSource(blob, encoding);
} catch (XMLStreamException ex) {
throw new OMException(ex);
} catch (IOException ex) {
throw new OMException(ex);
}
}
use of org.apache.axiom.blob.WritableBlob in project webservices-axiom by apache.
the class PartImpl method getInputStream.
@Override
public InputStream getInputStream(boolean preserve) {
if (!preserve && state == STATE_UNREAD) {
checkParserState(parser.getState(), EntityState.T_BODY);
state = STATE_STREAMING;
partInputStream = new PartInputStream(getDecodedInputStream(), blobFactory);
return partInputStream;
} else {
WritableBlob content = getContent();
try {
if (preserve) {
return content.getInputStream();
} else {
return new PartInputStream(content);
}
} catch (IOException ex) {
throw new MIMEException("Failed to retrieve part content from blob", ex);
}
}
}
Aggregations