Package com.sun.star.io

Examples of com.sun.star.io.XStream


        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


        {
            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

      // ================================================
      // create a temporary stream and a storage based on it
      // fill the storage with the data that will be used for testing
      // ================================================

      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

        { new StringPair( "Id", "Num5" ), new StringPair( "TargetMode", "" ), new StringPair( "Type", "unknown1" ), new StringPair( "Target", "URL value1" ) }
      };

    try
    {
      XStream xTempFileStream = m_aTestHelper.CreateTempFileStream( m_xMSF );
      if ( xTempFileStream == null )
        return false;
   
      // create storage based on the temporary stream
      XStorage xTempStorage = m_aTestHelper.createStorageFromStream( m_xStorageFactory,
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

    protected static void SaveDataToStorage( XStorage xStorage, String aString, Dimension aDimension ) throws com.sun.star.io.IOException
    {
        try
        {
            // save the text
            XStream xStream = xStorage.openStreamElement( "content.txt", com.sun.star.embed.ElementModes.READWRITE );
            XComponent xStreamComp = ( XComponent ) UnoRuntime.queryInterface( XComponent.class, xStream );
            if ( xStreamComp == null )
                throw new com.sun.star.uno.RuntimeException();

            XOutputStream xOutStream = xStream.getOutputStream();
            XTruncate xTruncate = ( XTruncate ) UnoRuntime.queryInterface( XTruncate.class, xOutStream );
            if ( xTruncate == null )
                throw new com.sun.star.io.IOException();

            xTruncate.truncate();
            xOutStream.writeBytes( aString.getBytes() );

            // save the size
            xStream = xStorage.openStreamElement( "properties.txt", com.sun.star.embed.ElementModes.READWRITE );
            xStreamComp = ( XComponent ) UnoRuntime.queryInterface( XComponent.class, xStream );
            if ( xStreamComp == null )
                throw new com.sun.star.uno.RuntimeException();

            xOutStream = xStream.getOutputStream();
            xTruncate = ( XTruncate ) UnoRuntime.queryInterface( XTruncate.class, xOutStream );
            if ( xTruncate == null )
                throw new com.sun.star.io.IOException();

            xTruncate.truncate();
View Full Code Here

      }

      Object oEmbObj = null;
      if ( xNameAccess.hasByName( "LinkName" ) && xTargetStorage.isStreamElement( "LinkName" ) )
      {
        XStream xLinkStream = xTargetStorage.openStreamElement( "LinkName", ElementModes.ELEMENT_READ );
        if ( xLinkStream != null )
        {
          XInputStream xInStream = xLinkStream.getInputStream();
          if ( xInStream != null )
          {
            byte[][] pBuff = new byte[1][0];
            int nRead = xInStream.readBytes( pBuff, 1000 );
            m_aLinkURI = new String( pBuff[0] );
View Full Code Here

        if ( xStorage == null )
            throw new com.sun.star.uno.RuntimeException();

        try
        {
            XStream xStream = xStorage.openStreamElement( aStreamName, com.sun.star.embed.ElementModes.READWRITE );
            XComponent xStreamComp = ( XComponent ) UnoRuntime.queryInterface( XComponent.class, xStream );
            if ( xStreamComp == null )
                throw new com.sun.star.uno.RuntimeException();

            XInputStream xInStream = xStream.getInputStream();
            byte[][] aData = new byte[1][];
            aData[0] = new byte[0];
            String aResult = new String();

            int nLen = 0;
View Full Code Here

  public void storeLinkToStorage()
  {
    if ( m_xStorage != null && m_bLinkObj )
    {
      try {
        XStream xLinkStream = m_xStorage.openStreamElement( "LinkName", ElementModes.ELEMENT_WRITE );

        if ( xLinkStream != null )
        {
          XOutputStream xLinkOutStream = xLinkStream.getOutputStream();
          XTruncate xTruncate = (XTruncate) UnoRuntime.queryInterface( XTruncate.class,
                                         xLinkOutStream );
          if ( xLinkOutStream != null && xTruncate != null )
          {
            xTruncate.truncate();
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.