Example usage for javax.xml.soap AttachmentPart getSize

List of usage examples for javax.xml.soap AttachmentPart getSize

Introduction

In this page you can find the example usage for javax.xml.soap AttachmentPart getSize.

Prototype

public abstract int getSize() throws SOAPException;

Source Link

Document

Returns the number of bytes in this AttachmentPart object.

Usage

From source file:org.apache.axis2.saaj.AttachmentTest.java

@Test
public void testBadAttSize() throws Exception {
    MessageFactory factory = MessageFactory.newInstance();
    SOAPMessage message = factory.createMessage();

    ByteArrayInputStream ins = new ByteArrayInputStream(new byte[5]);
    DataHandler dh = new DataHandler(new Src(ins, "text/plain"));
    AttachmentPart part = message.createAttachmentPart(dh);
    assertEquals("Size should match", 5, part.getSize());
}