sun.corba.EncapsInputStreamFactory Java Examples

The following examples show how to use sun.corba.EncapsInputStreamFactory. 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: CorbaClientRequestDispatcherImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #2
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #3
Source File: INSURLOperationImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #4
Source File: CorbaClientRequestDispatcherImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #5
Source File: INSURLOperationImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #6
Source File: INSURLOperationImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #7
Source File: INSURLOperationImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #8
Source File: CorbaClientRequestDispatcherImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #9
Source File: CorbaClientRequestDispatcherImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #10
Source File: INSURLOperationImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #11
Source File: INSURLOperationImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #12
Source File: CorbaClientRequestDispatcherImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #13
Source File: CorbaClientRequestDispatcherImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #14
Source File: INSURLOperationImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #15
Source File: INSURLOperationImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #16
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #17
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #18
Source File: INSURLOperationImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #19
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #20
Source File: INSURLOperationImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #21
Source File: EncapsulationUtility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** Helper method to read the octet array from is, deencapsulate it,
* and return
* as another InputStream.  This must be called inside the
* constructor of a derived class to obtain the correct stream
* for unmarshalling data.
*/
static public InputStream getEncapsulationStream( InputStream is )
{
    byte[] data = readOctets( is ) ;
    EncapsInputStream result = EncapsInputStreamFactory.newEncapsInputStream( is.orb(), data,
            data.length ) ;
    result.consumeEndian() ;
    return result ;
}
 
Example #22
Source File: EncapsOutputStream.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.portable.InputStream create_input_stream() {
    freeInternalCaches();

    return  EncapsInputStreamFactory.newEncapsInputStream(orb(),
            getByteBuffer(),
            getSize(),
            isLittleEndian(),
            getGIOPVersion());
}
 
Example #23
Source File: IIOPProfileImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public IIOPProfileImpl( ORB orb, org.omg.IOP.TaggedProfile profile)
{
    this( orb ) ;

    if (profile == null || profile.tag != TAG_INTERNET_IOP.value ||
        profile.profile_data == null) {
        throw wrapper.invalidTaggedProfile() ;
    }

    EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream((ORB)orb, profile.profile_data,
            profile.profile_data.length);
    istr.consumeEndian();
    init( istr ) ;
}
 
Example #24
Source File: EncapsOutputStream.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.portable.InputStream create_input_stream() {
    freeInternalCaches();

    return  EncapsInputStreamFactory.newEncapsInputStream(orb(),
            getByteBuffer(),
            getSize(),
            isLittleEndian(),
            getGIOPVersion());
}
 
Example #25
Source File: EncapsulationUtility.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Helper method to read the octet array from is, deencapsulate it,
* and return
* as another InputStream.  This must be called inside the
* constructor of a derived class to obtain the correct stream
* for unmarshalling data.
*/
static public InputStream getEncapsulationStream( InputStream is )
{
    byte[] data = readOctets( is ) ;
    EncapsInputStream result = EncapsInputStreamFactory.newEncapsInputStream( is.orb(), data,
            data.length ) ;
    result.consumeEndian() ;
    return result ;
}
 
Example #26
Source File: TypeCodeOutputStream.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.portable.InputStream create_input_stream()
{
    TypeCodeInputStream tcis = EncapsInputStreamFactory
            .newTypeCodeInputStream((ORB) orb(), getByteBuffer(),
                    getIndex(), isLittleEndian(), getGIOPVersion());
    //if (TypeCodeImpl.debug) {
        //System.out.println("Created TypeCodeInputStream " + tcis + " with no parent");
        //tcis.printBuffer();
    //}
    return tcis;
}
 
Example #27
Source File: TypeCodeInputStream.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static TypeCodeInputStream readEncapsulation(InputStream is, org.omg.CORBA.ORB _orb) {
    // _REVISIT_ Would be nice if we didn't have to copy the buffer!
    TypeCodeInputStream encap;

    int encapLength = is.read_long();

    // read off part of the buffer corresponding to the encapsulation
    byte[] encapBuffer = new byte[encapLength];
    is.read_octet_array(encapBuffer, 0, encapBuffer.length);

    // create an encapsulation using the marshal buffer
    if (is instanceof CDRInputStream) {
        encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
                encapBuffer, encapBuffer.length,
                ((CDRInputStream) is).isLittleEndian(),
                ((CDRInputStream) is).getGIOPVersion());
    } else {
        encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
                encapBuffer, encapBuffer.length);
    }
    encap.setEnclosingInputStream(is);
    encap.makeEncapsulation();
    //if (TypeCodeImpl.debug) {
        //System.out.println("Created TypeCodeInputStream " + encap + " with parent " + is);
        //encap.printBuffer();
    //}
    return encap;
}
 
Example #28
Source File: EncapsOutputStream.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.portable.InputStream create_input_stream() {
    freeInternalCaches();

    return  EncapsInputStreamFactory.newEncapsInputStream(orb(),
            getByteBuffer(),
            getSize(),
            isLittleEndian(),
            getGIOPVersion());
}
 
Example #29
Source File: IIOPProfileImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public IIOPProfileImpl( ORB orb, org.omg.IOP.TaggedProfile profile)
{
    this( orb ) ;

    if (profile == null || profile.tag != TAG_INTERNET_IOP.value ||
        profile.profile_data == null) {
        throw wrapper.invalidTaggedProfile() ;
    }

    EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream((ORB)orb, profile.profile_data,
            profile.profile_data.length);
    istr.consumeEndian();
    init( istr ) ;
}
 
Example #30
Source File: TypeCodeInputStream.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static TypeCodeInputStream readEncapsulation(InputStream is, org.omg.CORBA.ORB _orb) {
    // _REVISIT_ Would be nice if we didn't have to copy the buffer!
    TypeCodeInputStream encap;

    int encapLength = is.read_long();

    // read off part of the buffer corresponding to the encapsulation
    byte[] encapBuffer = new byte[encapLength];
    is.read_octet_array(encapBuffer, 0, encapBuffer.length);

    // create an encapsulation using the marshal buffer
    if (is instanceof CDRInputStream) {
        encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
                encapBuffer, encapBuffer.length,
                ((CDRInputStream) is).isLittleEndian(),
                ((CDRInputStream) is).getGIOPVersion());
    } else {
        encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
                encapBuffer, encapBuffer.length);
    }
    encap.setEnclosingInputStream(is);
    encap.makeEncapsulation();
    //if (TypeCodeImpl.debug) {
        //System.out.println("Created TypeCodeInputStream " + encap + " with parent " + is);
        //encap.printBuffer();
    //}
    return encap;
}