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

The following examples show how to use com.sun.xml.internal.messaging.saaj.util.FastInfosetReflection. 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
Source File: FastInfosetDataContentHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
Source File: EnvelopeImpl.java    From openjdk-8 with 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 #3
Source File: FastInfosetDataContentHandler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #4
Source File: FastInfosetDataContentHandler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
Source File: EnvelopeImpl.java    From openjdk-8-source with 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 #6
Source File: FastInfosetDataContentHandler.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #7
Source File: FastInfosetDataContentHandler.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
Source File: EnvelopeImpl.java    From hottub with 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 #9
Source File: FastInfosetDataContentHandler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #10
Source File: FastInfosetDataContentHandler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
Source File: EnvelopeImpl.java    From openjdk-jdk9 with 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 #12
Source File: FastInfosetDataContentHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #13
Source File: FastInfosetDataContentHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
Source File: EnvelopeImpl.java    From openjdk-jdk8u-backup with 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 #15
Source File: FastInfosetDataContentHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #16
Source File: FastInfosetDataContentHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
Source File: EnvelopeImpl.java    From openjdk-jdk8u with 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 #18
Source File: FastInfosetDataContentHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #19
Source File: FastInfosetDataContentHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #20
Source File: EnvelopeImpl.java    From TencentKona-8 with 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 #21
Source File: FastInfosetDataContentHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #22
Source File: EnvelopeImpl.java    From jdk8u60 with 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 #23
Source File: FastInfosetDataContentHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #24
Source File: FastInfosetDataContentHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 #25
Source File: FastInfosetDataContentHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Object getContent(DataSource dataSource) throws IOException {
    try {
        return FastInfosetReflection.FastInfosetSource_new(
            dataSource.getInputStream());
    }
    catch (Exception e) {
        throw new IOException(e.getMessage());
    }
}
 
Example #26
Source File: FastInfosetDataContentHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #27
Source File: FastInfosetDataContentHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Object getContent(DataSource dataSource) throws IOException {
    try {
        return FastInfosetReflection.FastInfosetSource_new(
            dataSource.getInputStream());
    }
    catch (Exception e) {
        throw new IOException(e.getMessage());
    }
}
 
Example #28
Source File: FastInfosetDataContentHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Object getContent(DataSource dataSource) throws IOException {
    try {
        return FastInfosetReflection.FastInfosetSource_new(
            dataSource.getInputStream());
    }
    catch (Exception e) {
        throw new IOException(e.getMessage());
    }
}
 
Example #29
Source File: FastInfosetDataContentHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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
Source File: FastInfosetDataContentHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}