Package com.sun.star.io

Examples of com.sun.star.io.XStream


        {
            throw new IOException("input is NULL");
        }
        try
        {
            final XStream xStream = (XStream) UnoRuntime.queryInterface(XStream.class, input.openStreamElement(name, ElementModes.READ));
            return new BufferedInputStream(new XInputStreamToInputStreamAdapter(xStream.getInputStream()), 102400);
        }
        catch (com.sun.star.uno.Exception e)
        {
            throw new IOException("createInputStream");
        }
View Full Code Here


        {
            throw new IOException("output is NULL");
        }
        try
        {
            final XStream stream = output.openStreamElement(name, ElementModes.WRITE | ElementModes.TRUNCATE);
            stream.getInputStream().closeInput();
            if (mimeType != null)
            {
                final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, stream);
                prop.setPropertyValue("MediaType", mimeType);
            }
            return new BufferedOutputStream(new XOutputStreamToOutputStreamAdapter(stream.getOutputStream()), 204800);
        }
        catch (com.sun.star.uno.Exception e)
        {
            throw new IOException("createOutputStream");
        }
View Full Code Here

      xClonedSubStorage = null;
      xClonedNameAccess = null;

      // the new stream was opened, written and closed, that means flashed
      // so the clone must contain all the information
      XStream xClonedSubStream = m_aTestHelper.cloneEncrSubStream( xTempStorage, "SubStream1", sPass1 );
      if ( !m_aTestHelper.InternalCheckStream( xClonedSubStream, "SubStream1", "MediaType1", true, pBytes1, true ) )
        return false;

      if ( !m_aTestHelper.disposeStream( xClonedSubStream, "SubStream1" ) )
        return false;
View Full Code Here

      xClonedSubStorage = null;
      xClonedNameAccess = null;

      // the new stream was opened, written and closed, that means flashed
      // so the clone must contain all the information
      XStream xClonedSubStream = m_aTestHelper.cloneSubStream( xTempStorage, "SubStream1" );
      if ( !m_aTestHelper.InternalCheckStream( xClonedSubStream, "SubStream1", "MediaType1", true, pBytes1, true ) )
        return false;

      if ( !m_aTestHelper.disposeStream( xClonedSubStream, "SubStream1" ) )
        return false;
View Full Code Here

      if ( !m_aTestHelper.cantOpenStorage( xTempFileStorage, "SubStorage1" ) )
        return false;


      // reopen created streams
      XStream xSubStream1 = m_aTestHelper.OpenStream( xSubSubStorage,
                              "SubStream1",
                              ElementModes.WRITE | ElementModes.NOCREATE );
      XStream xSubStream2 = m_aTestHelper.OpenStream( xSubSubStorage,
                              "SubStream2",
                              ElementModes.READ | ElementModes.NOCREATE );
      if ( xSubStream1 == null || xSubStream2 == null )
        return false;

      // it should be possible to have more then one copy of stream for reading
      XStream xSubStream2clone = m_aTestHelper.OpenStream( xSubSubStorage,
                                "SubStream2",
                                ElementModes.READ | ElementModes.NOCREATE );
      if ( xSubStream2 == null )
        return false;
View Full Code Here

    public boolean test()
  {
    try
    {
      XStream xTempFileStream = m_aTestHelper.CreateTempFileStream( m_xMSF );
      if ( xTempFileStream == null )
        return false;
   
      // create storage based on the temporary stream
      Object pArgs[] = new Object[2];
View Full Code Here

    public boolean test()
  {
    try
    {
      XStream xTempFileStream = m_aTestHelper.CreateTempFileStream( m_xMSF );
      if ( xTempFileStream == null )
        return false;
   
      // create storage based on the temporary stream
      Object pArgs[] = new Object[2];
View Full Code Here

        return "";
    }

    public XStream CreateTempFileStream(XMultiServiceFactory xMSF) {
        // try to get temporary file representation
        XStream xTempFileStream = null;
        try {
            Object oTempFile = xMSF.createInstance("com.sun.star.io.TempFile");
            xTempFileStream = (XStream) UnoRuntime.queryInterface(XStream.class, oTempFile);
        } catch (Exception e) {
        }
View Full Code Here

    public void insertSubStorage(String aName, String aBase64) {
        try {
            //decode the base64 string
            byte[] oledata = Base64.decode(aBase64);
            //create a temp stream to write data to
            XStream subStream = CreateTempFileStream(m_xMSF);
            XInputStream xInput = subStream.getInputStream();
            XOutputStream xOutput = subStream.getOutputStream();
            //write the length to the temp stream
            byte oleHead[] = new byte[4];
            oleHead[0] = (byte) ((oledata.length >>> 0) & 0xFF);
            oleHead[1] = (byte) ((oledata.length >>> 8) & 0xFF);
            oleHead[2] = (byte) ((oledata.length >>> 16) & 0xFF);
View Full Code Here

        if ( xContext != null )
        {
            try
            {           
                Object oTempFile = xContext.getServiceManager().createInstanceWithContext( "com.sun.star.io.TempFile", xContext );
                XStream xStream = ( XStream ) UnoRuntime.queryInterface( XStream.class, oTempFile );
                XSeekable xSeekable = ( XSeekable ) UnoRuntime.queryInterface( XSeekable.class, oTempFile );
                if ( xStream != null && xSeekable != null )
                {
                    XOutputStream xOutputStream = xStream.getOutputStream();
                    XInputStream xInputStream = xStream.getInputStream();
                    if ( xOutputStream != null && xInputStream != null )
                    {
                        String sHTML = sHTMLHeader.concat( sArticle );
                        sHTML = sHTML.concat( sHTMLFooter );
                        xOutputStream.writeBytes( sHTML.getBytes( "UTF-8" ) );           
View Full Code Here

TOP

Related Classes of com.sun.star.io.XStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.