    View Javadoc
    1   /*
    2    * Copyright (c) 2003
    3    * Information Desire GmbH
    4    * All rights reserved.
    5    */
    6   package com.infodesire.infobit.external.impl;
    7
    8   import com.infodesire.infobit.InfobitException;
    9   import com.infodesire.infobit.InfobitSecurityException;
    10
    11  import java.io.ByteArrayInputStream;
    12  import java.io.ByteArrayOutputStream;
    13  import java.io.InputStream;
    14  import java.io.OutputStream;
    15
    16  /***
    17   * This class buffers binary content versions.
    18   *
    19   * @author    peter2
    20   * @created   1. September 2003
    21   * @version   $Revision: 1.1 $
    22   */
    23  class BinaryContentNode extends ContentNode {
    24
    25      /***
    26       * Collects content. Temporary solution to be extended by appropriate
    27       * buffering.
    28       */
    29      private ByteArrayOutputStream _destination = new ByteArrayOutputStream();
    30
    31      /***
    32       * The type of the content, expressed as MIME type
    33       */
    34      private String  _mimeType;
    35
    36
    37      /***
    38       * Gets the destination for the buffered text content.
    39       *
    40       * @return   The Destination value
    41       */
    42      OutputStream getDestination() {
    43          return _destination;
    44      }
    45
    46
    47      /***
    48       * Defines the type of the content by its MIME type.
    49       *
    50       * @param mimeType  The new MimeType value
    51       */
    52      void setMimeType(String mimeType) {
    53          _mimeType = mimeType;
    54      }
    55
    56
    57      /***
    58       * Creates a binary version from the buffered data. Tempory version, keeping
    59       * all data in memeory.
    60       *
    61       * @return                              The created version
    62       * @exception InfobitException          Description of Exception
    63       * @exception InfobitSecurityException  Description of Exception
    64       */
    65      Object persistBuffer() throws InfobitException, InfobitSecurityException {
    66          byte[] data = _destination.toByteArray();
    67          InputStream str = new ByteArrayInputStream(data);
    68          _manager.createBinary(_infobit, _name, str, _mimeType, _keywords);
    69
    70          return resolveVersion();
    71      }
    72  }

This page was automatically generated by Maven