Initializes the {@code Demuxer} and open the specified input source.

@param inputSource an input source can be a file, device or a remote source.

@throws JavaAVException if {@code Demuxer} could not be opened.
183957
public void open(String inputSource) throws JavaAVException {
		AVInputFormat inputFormat = null;
		if (format != null && format.length() > 0) {
			inputFormat = av_find_input_format(format);

			if (inputFormat == null)
				throw new JavaAVException("Could not find input format: " + format);
		}

		formatContext = new AVFormatContext(null);

		AVDictionary options = new AVDictionary(null);
		if (frameRate > 0) {
			AVRational r = av_d2q(frameRate, 1001000);
			av_dict_set(options, "framerate", r.num() + "/" + r.den(), 0);
		}
		if (imageWidth > 0 && imageHeight > 0)
			av_dict_set(options, "video_size", imageWidth + "x" + imageHeight, 0);

		if (sampleRate > 0)
			av_dict_set(options, "sample_rate", "" + sampleRate, 0);

		if (audioChannels > 0)
			av_dict_set(options, "channels", "" + audioChannels, 0);

		if (avformat_open_input(formatContext, inputSource, inputFormat, options) < 0)
			throw new JavaAVException("Could not open input: " + inputSource);

		av_dict_free(options);

		// retrieve stream information
		if (avformat_find_stream_info(formatContext, (AVDictionary) null) < 0)
			throw new JavaAVException("Could not find stream information.");

		int streams = formatContext.nb_streams();
		videoDecoders = new HashMap<Integer, Decoder>();
		audioDecoders = new HashMap<Integer, Decoder>();

		// get a pointer to the codec context for the video or audio stream
		for (int index = 0; index < streams; index++) {
			AVStream stream = formatContext.streams(index);
			AVCodecContext context = stream.codec();

			if (context.codec_type() == AVMEDIA_TYPE_VIDEO) {
				initVideoDecoder(index, context);
			}
			else if (context.codec_type() == AVMEDIA_TYPE_AUDIO) {
				initAudioDecoder(index, context);
			}
		}

		if (videoDecoders.isEmpty() && audioDecoders.isEmpty())
			throw new JavaAVException("Could not find any video or audio stream.");

		avPacket = new AVPacket();
	}
228477
@Deprecated
	@SuppressWarnings("unchecked")
	public void addInput(List<Operator<IN>> inputs) {
		this.input = Operator.createUnionCascade(this.input, inputs.toArray(new Operator[inputs.size()]));
	}
23153
@Deprecated
    public static synchronized void initializeFromResource(
            final ClassLoader classLoader,
            final String name) {

        try {
            regionMetadata = loadMetadataFromResource(classLoader, name);
        } catch (IOException exception) {
            throw new SdkClientException(
                    "Error parsing region metadata from resource " + name,
                    exception);
        }
    }
66834
@Override
    public final void addSourceListener(SourceListener<S> listener) {
        if (listener != null) {
            this.listenerList.add(listener);
        }
    }
1008781
public void setSourceUrl(java.util.Collection<StringFilter> sourceUrl) {
        if (sourceUrl == null) {
            this.sourceUrl = null;
            return;
        }

        this.sourceUrl = new java.util.ArrayList<StringFilter>(sourceUrl);
    }
952705
protected void addSource (
        DragSource source, JComponent comp, boolean autoremove)
    {
        _draggers.put(comp, source);
        comp.addMouseListener(_sourceListener);
        comp.addMouseMotionListener(_sourceListener);
        if (autoremove) {
            comp.addAncestorListener(_remover);
        }
    }
869582
public static void addDragSource (
        DragSource source, JComponent comp, boolean autoremove)
    {
        singleton.addSource(source, comp, autoremove);
    }
361914
@SuppressWarnings("resource")
    @Override
    public void parse(InputSource input) throws SAXException
    {
        mScanner = null;
        String sysIdStr = input.getSystemId();
        ReaderConfig cfg = mConfig;
        URL srcUrl = null;

        // Let's figure out input, first, before sending start-doc event
        InputStream is = null;
        Reader r = input.getCharacterStream();
        if (r == null) {
            is = input.getByteStream();
            if (is == null) {
                if (sysIdStr == null) {
                    throw new SAXException("Invalid InputSource passed: neither character or byte stream passed, nor system id specified");
                }
                try {
                    srcUrl = URLUtil.urlFromSystemId(sysIdStr);
                    is = URLUtil.inputStreamFromURL(srcUrl);
                } catch (IOException ioe) {
                    SAXException saxe = new SAXException(ioe);
                    ExceptionUtil.setInitCause(saxe, ioe);
                    throw saxe;
                }
            }
        }

        if (mContentHandler != null) {
            mContentHandler.setDocumentLocator(this);
            mContentHandler.startDocument();
        }

        /* Note: since we are reusing the same config instance, need to
         * make sure state is not carried forward. Thus:
         */
        cfg.resetState();

        try {
            String inputEnc = input.getEncoding();
            String publicId = input.getPublicId();

            // Got an InputStream and encoding? Can create a Reader:
            if (r == null && (inputEnc != null && inputEnc.length() > 0)) {
                r = DefaultInputResolver.constructOptimizedReader(cfg, is, false, inputEnc);
            }
            InputBootstrapper bs;
            SystemId systemId = SystemId.construct(sysIdStr, srcUrl);
            if (r != null) {
                bs = ReaderBootstrapper.getInstance(publicId, systemId, r, inputEnc);
                // false -> not for event reader; false -> no auto-closing
                mScanner = (BasicStreamReader) mStaxFactory.createSR(cfg, systemId, bs, false, false);
            } else {
                bs = StreamBootstrapper.getInstance(publicId, systemId, is);
                mScanner = (BasicStreamReader) mStaxFactory.createSR(cfg, systemId, bs, false, false);
            }

            // Need to get xml declaration stuff out now:
            {
                String enc2 = mScanner.getEncoding();
                if (enc2 == null) {
                    enc2 = mScanner.getCharacterEncodingScheme();
                }
                mEncoding = enc2;
            }
            mXmlVersion = mScanner.getVersion();
            mStandalone = mScanner.standaloneSet();
            mAttrCollector = mScanner.getAttributeCollector();
            mElemStack = mScanner.getInputElementStack();
            fireEvents();
        } catch (IOException io) {
            throwSaxException(io);
        } catch (XMLStreamException strex) {
            throwSaxException(strex);
        } finally {
            if (mContentHandler != null) {
                mContentHandler.endDocument();
            }
            // Could try holding onto the buffers, too... but
            // maybe it's better to allow them to be reclaimed, if
            // needed by GC
            if (mScanner != null) {
                BasicStreamReader sr = mScanner;
                mScanner = null;
                try {
                    sr.close();
                } catch (XMLStreamException sex) { }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException ioe) { }
            }
            if (is != null) {
                try {
                    is.close();
                } catch (IOException ioe) { }
            }
        }
    }
1265933
public void detachAllProducersForNewInputHandler(ProducerInputHandler newHandler)throws SIException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "detachAllProducersForNewInputHandler", newHandler);

    //detach all producers and update
    synchronized (_producers)
    {
      Iterator<MessageProducer> it = _producers.iterator();
      while(it.hasNext())
      {
        ProducerSessionImpl prod = (ProducerSessionImpl)it.next();
        it.remove();
        //attach this to the new input handler
        newHandler.attachProducer(prod);
        prod.updateInputHandler(newHandler);
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "detachAllProducersForNewInputHandler");
  }
1242609
public InputStream openInputStream()
    throws IOException
  {
    StreamSource indirectSource = _indirectSource;
    
    if (indirectSource != null) {
      return indirectSource.openInputStream();
    }
    
    TempOutputStream out = _out;
    if (out != null) {
      return out.openInputStreamNoFree();
    }
    
    // System.err.println("OpenInputStream: fail to open input stream for " + this);
    throw new IOException(L.l("{0}: no input stream is available",
                              this));
  }
399153
public static DataSource initializeTxSimple(DataSource dataSource) {
      TxTransactionManager txManager = new TxTransactionManager(dataSource);
      return initializeTxCustom(txManager.getTxDataSource(), txManager, txManager);
   }
411230
private void showDialog(@NonNull final Source source) {
        // Caching the source object here because this app makes a lot of them.
        mRedirectSource = source;

        final SourceRedirect sourceRedirect = source.getRedirect();
        final String redirectUrl = sourceRedirect != null ? sourceRedirect.getUrl() : null;
        if (redirectUrl != null) {
            mRedirectDialogController.showDialog(redirectUrl);
        }
    }
32607
public final void setDataSource(DataSource dataSource) {
		if (this.jdbcTemplate == null || dataSource != this.jdbcTemplate.getDataSource()) {
			this.jdbcTemplate = createJdbcTemplate(dataSource);
			initTemplateConfig();
		}
	}
15192
InputSource createInputSource(byte[] data, String systemId) {

        InputSource result = new InputSource(new ByteArrayInputStream(data));
        result.setSystemId(systemId);
        return result;
    }
81202
public void reconstituteSourceStreams(DestinationHandler dest, PtoPOutputHandler outputHandler, int startMode) 
  
  throws MessageStoreException, SIDiscriminatorSyntaxException, SIErrorException, SIResourceException
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "reconstituteSourceStreams", new Integer(startMode));

    
    /*
     * Iterate through all contained Protocol Items, looking for StreamSet
     * associated with source. Note that outputHandler passed in is null if this 
     * is Pubsub. 
     */ 
     
    SourceStreamSetFilter filter = null;
    if( dest.isPubSub())
    { 
      filter = new SourceStreamSetFilter(null);
    }
    else
    {
      filter = new SourceStreamSetFilter(outputHandler.getTargetMEUuid());
    }
    
    NonLockingCursor cursor = null;
    
    try
    {
      cursor = newNonLockingItemCursor(filter);    
           
	    AbstractItem item = null;
	    
	    //should only be one match!!
	    while (null != (item = cursor.next()))
	    {
	      StreamSet streamSet = (StreamSet)item;
          streamSet.initializeNonPersistent(dest.getTxManager());
	      
	      // Don't do flush if we are asked to start in recovery mode 
	      if(   ((startMode & JsConstants.ME_START_FLUSH ) == JsConstants.ME_START_FLUSH )
	         && ((startMode & JsConstants.ME_START_RECOVERY ) == 0 ) )
	      {
	        // Log message to console saying we have started flush for this steamSet
	        // parmeters are:- ME name, streamSet Uuid, destinationName
	        SibTr.info(
	          tc,
	          "FLUSH_INITIATED_MESSAGE_CWSIP0781",
	          new Object[] { dest.getMessageProcessor().getMessagingEngineName(),
	                        streamSet.getStreamID(),
	                        dest.getName() });
	      }
	      try
	      {
	        if( dest.isPubSub())
	        {
	          PubSubInputHandler inputHandler = (PubSubInputHandler)dest.getInputHandler();
	          inputHandler.reconstitutePubSubSourceStreams(streamSet, startMode);
	        }
	        else
	        {        
	          outputHandler.reconstitutePtoPSourceStreams(streamSet, startMode);
	        }
	      }
	      catch (SIResourceException e)
	      {
	        // FFDC
	        FFDCFilter.processException(
	          e,
	          "com.ibm.ws.sib.processor.impl.store.itemstreams.SourceProtocolItemStream.reconstituteSourceStreams",
	          "1:179:1.29",
	          this);
	        
	        // Don't do flush if we are asked to start in recovery mode 
	        if(   ((startMode & JsConstants.ME_START_FLUSH ) == JsConstants.ME_START_FLUSH )
	           && ((startMode & JsConstants.ME_START_RECOVERY ) == 0 ) )
	        {
	          // Log message to console saying flush for this steamSet has failed
	          // parmeters are:- ME name, streamSet Uuid, destinationName, exception.
	          SibTr.error(
	            tc,
	            "FLUSH_FAILED_MESSAGE_CWSIP0782",
	            new Object[] {dest.getMessageProcessor().getMessagingEngineName(),
	                          streamSet.getStreamID(),
	                          dest.getName(),
	                          e });
	        }
	        
	        // Rethrow exception after logging error
	        if (tc.isEntryEnabled()) SibTr.exit(tc, "reconstituteSourceStreams");
	        throw(e);
	      
	      }
	    }
    }
    finally
    {
      if (cursor != null)
        cursor.finished();
    }
    
    if (tc.isEntryEnabled())  
      SibTr.exit(tc, "reconstituteSourceStreams");      
  }
1229144
@SuppressWarnings("unchecked")
	public void open(File inputFile) throws IOException {
		deserializer = (Deserializer<OUT>) (readAsByteArray ? new ByteArrayDeserializer() : new TupleDeserializer());

		inputFile.getParentFile().mkdirs();

		if (inputFile.exists()) {
			inputFile.delete();
		}
		inputFile.createNewFile();
		inputRAF = new RandomAccessFile(inputFile, "rw");
		inputRAF.setLength(mappedFileSizeBytes);
		inputRAF.seek(mappedFileSizeBytes - 1);
		inputRAF.writeByte(0);
		inputRAF.seek(0);
		inputChannel = inputRAF.getChannel();
		fileBuffer = inputChannel.map(FileChannel.MapMode.READ_WRITE, 0, mappedFileSizeBytes);
	}
1001753
public void addFile(String sourceFolder, String name, ClassLoaderFile file) {
		Assert.notNull(sourceFolder, "SourceFolder must not be null");
		Assert.notNull(name, "Name must not be null");
		Assert.notNull(file, "File must not be null");
		removeAll(name);
		getOrCreateSourceFolder(sourceFolder).add(name, file);
	}