Java Code Examples for com.sun.xml.internal.messaging.saaj.util.FastInfosetReflection

The following examples show how to use com.sun.xml.internal.messaging.saaj.util.FastInfosetReflection. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * return the Transfer Data of type DataFlavor from InputStream
 * @param df The DataFlavor.
 * @param ins The InputStream corresponding to the data.
 * @return The constructed Object.
 */
public Object getTransferData(DataFlavor flavor, DataSource dataSource)
    throws IOException
{
    if (flavor.getMimeType().startsWith("application/fastinfoset")) {
        try {
            if (flavor.getRepresentationClass().getName().equals(STR_SRC)) {
                return FastInfosetReflection.FastInfosetSource_new(
                    dataSource.getInputStream());
            }
        }
        catch (Exception e) {
            throw new IOException(e.getMessage());
        }
    }
    return null;
}
 
Example 2
/**
 * construct an object from a byte stream
 * (similar semantically to previous method, we are deciding
 *  which one to support)
 */
public void writeTo(Object obj, String mimeType, OutputStream os)
    throws IOException
{
    if (!mimeType.equals("application/fastinfoset")) {
        throw new IOException("Invalid content type \"" + mimeType
            + "\" for FastInfosetDCH");
    }

    try {
        InputStream is = FastInfosetReflection.FastInfosetSource_getInputStream(
            (Source) obj);

        int n; byte[] buffer = new byte[4096];
        while ((n = is.read(buffer)) != -1) {
            os.write(buffer, 0, n);
        }
    }
    catch (Exception ex) {
        throw new IOException(
            "Error copying FI source to output stream " + ex.getMessage());
    }
}
 
Example 3
Source Project: TencentKona-8   Source File: EnvelopeImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Serialize to FI if boolean parameter set.
 */
public void output(OutputStream out, boolean isFastInfoset)
    throws IOException
{
    if (!isFastInfoset) {
        output(out);
    }
    else {
        try {
            // Run transform and generate FI output from content
            Source source = getContent();
            Transformer transformer = EfficientStreamingTransformer.newTransformer();
                transformer.transform(getContent(),
                    FastInfosetReflection.FastInfosetResult_new(out));
        }
        catch (Exception ex) {
            throw new IOException(ex.getMessage());
        }
    }
}
 
Example 4
/**
 * return the Transfer Data of type DataFlavor from InputStream
 * @param df The DataFlavor.
 * @param ins The InputStream corresponding to the data.
 * @return The constructed Object.
 */
public Object getTransferData(DataFlavor flavor, DataSource dataSource)
    throws IOException
{
    if (flavor.getMimeType().startsWith("application/fastinfoset")) {
        try {
            if (flavor.getRepresentationClass().getName().equals(STR_SRC)) {
                return FastInfosetReflection.FastInfosetSource_new(
                    dataSource.getInputStream());
            }
        }
        catch (Exception e) {
            throw new IOException(e.getMessage());
        }
    }
    return null;
}
 
Example 5
/**
 * construct an object from a byte stream
 * (similar semantically to previous method, we are deciding
 *  which one to support)
 */
public void writeTo(Object obj, String mimeType, OutputStream os)
    throws IOException
{
    if (!mimeType.equals("application/fastinfoset")) {
        throw new IOException("Invalid content type \"" + mimeType
            + "\" for FastInfosetDCH");
    }

    try {
        InputStream is = FastInfosetReflection.FastInfosetSource_getInputStream(
            (Source) obj);

        int n; byte[] buffer = new byte[4096];
        while ((n = is.read(buffer)) != -1) {
            os.write(buffer, 0, n);
        }
    }
    catch (Exception ex) {
        throw new IOException(
            "Error copying FI source to output stream " + ex.getMessage());
    }
}
 
Example 6
Source Project: jdk8u60   Source File: EnvelopeImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Serialize to FI if boolean parameter set.
 */
public void output(OutputStream out, boolean isFastInfoset)
    throws IOException
{
    if (!isFastInfoset) {
        output(out);
    }
    else {
        try {
            // Run transform and generate FI output from content
            Source source = getContent();
            Transformer transformer = EfficientStreamingTransformer.newTransformer();
                transformer.transform(getContent(),
                    FastInfosetReflection.FastInfosetResult_new(out));
        }
        catch (Exception ex) {
            throw new IOException(ex.getMessage());
        }
    }
}
 
Example 7
/**
 * return the Transfer Data of type DataFlavor from InputStream
 * @param df The DataFlavor.
 * @param ins The InputStream corresponding to the data.
 * @return The constructed Object.
 */
public Object getTransferData(DataFlavor flavor, DataSource dataSource)
    throws IOException
{
    if (flavor.getMimeType().startsWith("application/fastinfoset")) {
        try {
            if (flavor.getRepresentationClass().getName().equals(STR_SRC)) {
                return FastInfosetReflection.FastInfosetSource_new(
                    dataSource.getInputStream());
            }
        }
        catch (Exception e) {
            throw new IOException(e.getMessage());
        }
    }
    return null;
}
 
Example 8
/**
 * construct an object from a byte stream
 * (similar semantically to previous method, we are deciding
 *  which one to support)
 */
public void writeTo(Object obj, String mimeType, OutputStream os)
    throws IOException
{
    if (!mimeType.equals("application/fastinfoset")) {
        throw new IOException("Invalid content type \"" + mimeType
            + "\" for FastInfosetDCH");
    }

    try {
        InputStream is = FastInfosetReflection.FastInfosetSource_getInputStream(
            (Source) obj);

        int n; byte[] buffer = new byte[4096];
        while ((n = is.read(buffer)) != -1) {
            os.write(buffer, 0, n);
        }
    }
    catch (Exception ex) {
        throw new IOException(
            "Error copying FI source to output stream " + ex.getMessage());
    }
}
 
Example 9
Source Project: openjdk-jdk8u   Source File: EnvelopeImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Serialize to FI if boolean parameter set.
 */
public void output(OutputStream out, boolean isFastInfoset)
    throws IOException
{
    if (!isFastInfoset) {
        output(out);
    }
    else {
        try {
            // Run transform and generate FI output from content
            Source source = getContent();
            Transformer transformer = EfficientStreamingTransformer.newTransformer();
                transformer.transform(getContent(),
                    FastInfosetReflection.FastInfosetResult_new(out));
        }
        catch (Exception ex) {
            throw new IOException(ex.getMessage());
        }
    }
}
 
Example 10
/**
 * return the Transfer Data of type DataFlavor from InputStream
 * @param df The DataFlavor.
 * @param ins The InputStream corresponding to the data.
 * @return The constructed Object.
 */
public Object getTransferData(DataFlavor flavor, DataSource dataSource)
    throws IOException
{
    if (flavor.getMimeType().startsWith("application/fastinfoset")) {
        try {
            if (flavor.getRepresentationClass().getName().equals(STR_SRC)) {
                return FastInfosetReflection.FastInfosetSource_new(
                    dataSource.getInputStream());
            }
        }
        catch (Exception e) {
            throw new IOException(e.getMessage());
        }
    }
    return null;
}
 
Example 11
/**
 * construct an object from a byte stream
 * (similar semantically to previous method, we are deciding
 *  which one to support)
 */
public void writeTo(Object obj, String mimeType, OutputStream os)
    throws IOException
{
    if (!mimeType.equals("application/fastinfoset")) {
        throw new IOException("Invalid content type \"" + mimeType
            + "\" for FastInfosetDCH");
    }

    try {
        InputStream is = FastInfosetReflection.FastInfosetSource_getInputStream(
            (Source) obj);

        int n; byte[] buffer = new byte[4096];
        while ((n = is.read(buffer)) != -1) {
            os.write(buffer, 0, n);
        }
    }
    catch (Exception ex) {
        throw new IOException(
            "Error copying FI source to output stream " + ex.getMessage());
    }
}
 
Example 12
/**
 * Serialize to FI if boolean parameter set.
 */
public void output(OutputStream out, boolean isFastInfoset)
    throws IOException
{
    if (!isFastInfoset) {
        output(out);
    }
    else {
        try {
            // Run transform and generate FI output from content
            Source source = getContent();
            Transformer transformer = EfficientStreamingTransformer.newTransformer();
                transformer.transform(getContent(),
                    FastInfosetReflection.FastInfosetResult_new(out));
        }
        catch (Exception ex) {
            throw new IOException(ex.getMessage());
        }
    }
}
 
Example 13
/**
 * Return the Transfer Data of type DataFlavor from InputStream
 * @param flavor The DataFlavor.
 * @param dataSource DataSource.
 * @return The constructed Object.
 * @exception IOException in case of an I/O error
 */
@Override
public Object getTransferData(DataFlavor flavor, DataSource dataSource)
    throws IOException
{
    if (flavor.getMimeType().startsWith("application/fastinfoset")) {
        try {
            if (flavor.getRepresentationClass().getName().equals(STR_SRC)) {
                return FastInfosetReflection.FastInfosetSource_new(
                    dataSource.getInputStream());
            }
        }
        catch (Exception e) {
            throw new IOException(e.getMessage());
        }
    }
    return null;
}
 
Example 14
/**
 * Construct an object from a byte stream
 * (similar semantically to previous method, we are deciding
 *  which one to support)
 */
@Override
public void writeTo(Object obj, String mimeType, OutputStream os)
    throws IOException
{
    if (!mimeType.equals("application/fastinfoset")) {
        throw new IOException("Invalid content type \"" + mimeType
            + "\" for FastInfosetDCH");
    }

    try {
        InputStream is = FastInfosetReflection.FastInfosetSource_getInputStream(
            (Source) obj);

        int n; byte[] buffer = new byte[4096];
        while ((n = is.read(buffer)) != -1) {
            os.write(buffer, 0, n);
        }
    }
    catch (Exception ex) {
        throw new IOException(
            "Error copying FI source to output stream " + ex.getMessage());
    }
}
 
Example 15
Source Project: openjdk-jdk9   Source File: EnvelopeImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Serialize to FI if boolean parameter set.
 */
@Override
public void output(OutputStream out, boolean isFastInfoset)
    throws IOException
{
    if (!isFastInfoset) {
        output(out);
    }
    else {
        try {
            // Run transform and generate FI output from content
            Transformer transformer = EfficientStreamingTransformer.newTransformer();
                transformer.transform(getContent(),
                    FastInfosetReflection.FastInfosetResult_new(out));
        }
        catch (Exception ex) {
            throw new IOException(ex.getMessage());
        }
    }
}
 
Example 16
/**
 * return the Transfer Data of type DataFlavor from InputStream
 * @param df The DataFlavor.
 * @param ins The InputStream corresponding to the data.
 * @return The constructed Object.
 */
public Object getTransferData(DataFlavor flavor, DataSource dataSource)
    throws IOException
{
    if (flavor.getMimeType().startsWith("application/fastinfoset")) {
        try {
            if (flavor.getRepresentationClass().getName().equals(STR_SRC)) {
                return FastInfosetReflection.FastInfosetSource_new(
                    dataSource.getInputStream());
            }
        }
        catch (Exception e) {
            throw new IOException(e.getMessage());
        }
    }
    return null;
}
 
Example 17
/**
 * construct an object from a byte stream
 * (similar semantically to previous method, we are deciding
 *  which one to support)
 */
public void writeTo(Object obj, String mimeType, OutputStream os)
    throws IOException
{
    if (!mimeType.equals("application/fastinfoset")) {
        throw new IOException("Invalid content type \"" + mimeType
            + "\" for FastInfosetDCH");
    }

    try {
        InputStream is = FastInfosetReflection.FastInfosetSource_getInputStream(
            (Source) obj);

        int n; byte[] buffer = new byte[4096];
        while ((n = is.read(buffer)) != -1) {
            os.write(buffer, 0, n);
        }
    }
    catch (Exception ex) {
        throw new IOException(
            "Error copying FI source to output stream " + ex.getMessage());
    }
}
 
Example 18
Source Project: hottub   Source File: EnvelopeImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Serialize to FI if boolean parameter set.
 */
public void output(OutputStream out, boolean isFastInfoset)
    throws IOException
{
    if (!isFastInfoset) {
        output(out);
    }
    else {
        try {
            // Run transform and generate FI output from content
            Source source = getContent();
            Transformer transformer = EfficientStreamingTransformer.newTransformer();
                transformer.transform(getContent(),
                    FastInfosetReflection.FastInfosetResult_new(out));
        }
        catch (Exception ex) {
            throw new IOException(ex.getMessage());
        }
    }
}
 
Example 19
/**
 * return the Transfer Data of type DataFlavor from InputStream
 * @param df The DataFlavor.
 * @param ins The InputStream corresponding to the data.
 * @return The constructed Object.
 */
public Object getTransferData(DataFlavor flavor, DataSource dataSource)
    throws IOException
{
    if (flavor.getMimeType().startsWith("application/fastinfoset")) {
        try {
            if (flavor.getRepresentationClass().getName().equals(STR_SRC)) {
                return FastInfosetReflection.FastInfosetSource_new(
                    dataSource.getInputStream());
            }
        }
        catch (Exception e) {
            throw new IOException(e.getMessage());
        }
    }
    return null;
}
 
Example 20
/**
 * construct an object from a byte stream
 * (similar semantically to previous method, we are deciding
 *  which one to support)
 */
public void writeTo(Object obj, String mimeType, OutputStream os)
    throws IOException
{
    if (!mimeType.equals("application/fastinfoset")) {
        throw new IOException("Invalid content type \"" + mimeType
            + "\" for FastInfosetDCH");
    }

    try {
        InputStream is = FastInfosetReflection.FastInfosetSource_getInputStream(
            (Source) obj);

        int n; byte[] buffer = new byte[4096];
        while ((n = is.read(buffer)) != -1) {
            os.write(buffer, 0, n);
        }
    }
    catch (Exception ex) {
        throw new IOException(
            "Error copying FI source to output stream " + ex.getMessage());
    }
}
 
Example 21
/**
 * Serialize to FI if boolean parameter set.
 */
public void output(OutputStream out, boolean isFastInfoset)
    throws IOException
{
    if (!isFastInfoset) {
        output(out);
    }
    else {
        try {
            // Run transform and generate FI output from content
            Source source = getContent();
            Transformer transformer = EfficientStreamingTransformer.newTransformer();
                transformer.transform(getContent(),
                    FastInfosetReflection.FastInfosetResult_new(out));
        }
        catch (Exception ex) {
            throw new IOException(ex.getMessage());
        }
    }
}
 
Example 22
/**
 * return the Transfer Data of type DataFlavor from InputStream
 * @param df The DataFlavor.
 * @param ins The InputStream corresponding to the data.
 * @return The constructed Object.
 */
public Object getTransferData(DataFlavor flavor, DataSource dataSource)
    throws IOException
{
    if (flavor.getMimeType().startsWith("application/fastinfoset")) {
        try {
            if (flavor.getRepresentationClass().getName().equals(STR_SRC)) {
                return FastInfosetReflection.FastInfosetSource_new(
                    dataSource.getInputStream());
            }
        }
        catch (Exception e) {
            throw new IOException(e.getMessage());
        }
    }
    return null;
}
 
Example 23
/**
 * construct an object from a byte stream
 * (similar semantically to previous method, we are deciding
 *  which one to support)
 */
public void writeTo(Object obj, String mimeType, OutputStream os)
    throws IOException
{
    if (!mimeType.equals("application/fastinfoset")) {
        throw new IOException("Invalid content type \"" + mimeType
            + "\" for FastInfosetDCH");
    }

    try {
        InputStream is = FastInfosetReflection.FastInfosetSource_getInputStream(
            (Source) obj);

        int n; byte[] buffer = new byte[4096];
        while ((n = is.read(buffer)) != -1) {
            os.write(buffer, 0, n);
        }
    }
    catch (Exception ex) {
        throw new IOException(
            "Error copying FI source to output stream " + ex.getMessage());
    }
}
 
Example 24
Source Project: openjdk-8   Source File: EnvelopeImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Serialize to FI if boolean parameter set.
 */
public void output(OutputStream out, boolean isFastInfoset)
    throws IOException
{
    if (!isFastInfoset) {
        output(out);
    }
    else {
        try {
            // Run transform and generate FI output from content
            Source source = getContent();
            Transformer transformer = EfficientStreamingTransformer.newTransformer();
                transformer.transform(getContent(),
                    FastInfosetReflection.FastInfosetResult_new(out));
        }
        catch (Exception ex) {
            throw new IOException(ex.getMessage());
        }
    }
}
 
Example 25
/**
 * return the DataFlavors for this <code>DataContentHandler</code>
 * @return The DataFlavors.
 */
public DataFlavor[] getTransferDataFlavors() { // throws Exception;
    DataFlavor flavors[] = new DataFlavor[1];
    flavors[0] = new ActivationDataFlavor(
            FastInfosetReflection.getFastInfosetSource_class(),
            "application/fastinfoset", "Fast Infoset");
    return flavors;
}
 
Example 26
public Object getContent(DataSource dataSource) throws IOException {
    try {
        return FastInfosetReflection.FastInfosetSource_new(
            dataSource.getInputStream());
    }
    catch (Exception e) {
        throw new IOException(e.getMessage());
    }
}
 
Example 27
/**
 * return the DataFlavors for this <code>DataContentHandler</code>
 * @return The DataFlavors.
 */
public DataFlavor[] getTransferDataFlavors() { // throws Exception;
    DataFlavor flavors[] = new DataFlavor[1];
    flavors[0] = new ActivationDataFlavor(
            FastInfosetReflection.getFastInfosetSource_class(),
            "application/fastinfoset", "Fast Infoset");
    return flavors;
}
 
Example 28
public Object getContent(DataSource dataSource) throws IOException {
    try {
        return FastInfosetReflection.FastInfosetSource_new(
            dataSource.getInputStream());
    }
    catch (Exception e) {
        throw new IOException(e.getMessage());
    }
}
 
Example 29
/**
 * return the DataFlavors for this <code>DataContentHandler</code>
 * @return The DataFlavors.
 */
public DataFlavor[] getTransferDataFlavors() { // throws Exception;
    DataFlavor flavors[] = new DataFlavor[1];
    flavors[0] = new ActivationDataFlavor(
            FastInfosetReflection.getFastInfosetSource_class(),
            "application/fastinfoset", "Fast Infoset");
    return flavors;
}
 
Example 30
public Object getContent(DataSource dataSource) throws IOException {
    try {
        return FastInfosetReflection.FastInfosetSource_new(
            dataSource.getInputStream());
    }
    catch (Exception e) {
        throw new IOException(e.getMessage());
    }
}