Examples of StreamDataSource


Examples of edu.cmu.sphinx.frontend.util.StreamDataSource

     * @param args argv[0] : The name of an audio file argv[1] : SphinxProperties file
     */
    static public void main(String[] args) {
        FrontEnd frontEnd;
        FrontEnd cepstrumFrontEnd;
        StreamDataSource dataSource;
        StreamDataSource cepstrumDataSource;

        prefs = Preferences.userRoot().node(PREFS_CONTEXT);
        filename = prefs.get(FILENAME_PREFERENCE, "untitled.raw");
        file = new File(filename);

View Full Code Here

Examples of edu.cmu.sphinx.frontend.util.StreamDataSource

        ConfigurationManager cm = new ConfigurationManager(configURL);
        setProperty(cm, "trigramModel", "location", lm.toString());

        Recognizer recognizer = cm.lookup("recognizer");
        StreamDataSource dataSource = cm.lookup(StreamDataSource.class);

        AudioInputStream ais = getAudioInputStream(audioFileURL);
        dataSource.setInputStream(ais);

        recognizer.allocate();
        Lattice lattice = new Lattice(recognizer.recognize());

        cm = new ConfigurationManager(configURL);
        setProperty(cm, "keepAllTokens", "true");
        setProperty(cm, "trigramModel", "location", lm.toString());

        recognizer = cm.lookup("recognizer");
        recognizer.allocate();
        dataSource = cm.lookup(StreamDataSource.class);
        dataSource.setInputStream(getAudioInputStream(audioFileURL));
        Lattice allLattice = new Lattice(recognizer.recognize());

        assertTrue(lattice.isEquivalent(allLattice));
    }
View Full Code Here

Examples of org.apache.clerezza.triaxrs.util.StreamDataSource

  @Override
  public T readFrom(Class<T> type, Type genericType,
      Annotation[] annotations, MediaType mediaType,
      MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
      throws IOException, WebApplicationException {
    DataSource dataSource = new StreamDataSource(entityStream, mediaType
        .toString());
    DataHandler dataHandler = new DataHandler(dataSource);
    try {
      Object content = dataHandler.getContent();
      if (content.getClass().isAssignableFrom(type)) {
View Full Code Here

Examples of org.apache.servicemix.jbi.util.StreamDataSource

        this.contentType = contentType;
    }

    public void readMessage(MessageExchange exchange, NormalizedMessage message,
                            InputStream in, String path) throws IOException, JBIException {
        DataSource ds = new StreamDataSource(in, contentType);
        DataHandler handler = new DataHandler(ds);
        message.addAttachment(attachment, handler);
        message.setProperty(FILE_NAME_PROPERTY, new File(path).getName());
        message.setProperty(FILE_PATH_PROPERTY, path);
    }
View Full Code Here

Examples of org.apache.servicemix.jbi.util.StreamDataSource

  public void setContentType(String contentType) {
    this.contentType = contentType;
  }

    public void readMessage(MessageExchange exchange, NormalizedMessage message, InputStream in, String path) throws IOException, JBIException {
      DataSource ds = new StreamDataSource(in, contentType);
      DataHandler handler = new DataHandler(ds);
      message.addAttachment(attachment, handler);
        message.setProperty(FILE_NAME_PROPERTY, new File(path).getName());
        message.setProperty(FILE_PATH_PROPERTY, path);
    }
View Full Code Here

Examples of org.apache.servicemix.jbi.util.StreamDataSource

        me.setOperation(new QName("uri", "op"));
        me.setProperty("myProp", "myValue");
        NormalizedMessage msg = me.createMessage();
        msg.setProperty("myMsgProp", "myMsgValue");
        msg.setContent(src);
        msg.addAttachment("myAttachment", new DataHandler(new StreamDataSource(new ByteArrayInputStream("hello".getBytes()))));
        me.setMessage(msg, "in");
        assertNotNull(((NormalizedMessageImpl) msg).getBody());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
View Full Code Here

Examples of org.apache.servicemix.jbi.util.StreamDataSource

        me.setOperation(new QName("uri", "op"));
        me.setProperty("myProp", "myValue");
        NormalizedMessage msg = me.createMessage();
        msg.setProperty("myMsgProp", "myMsgValue");
        msg.setContent(src);
        msg.addAttachment("myAttachment", new DataHandler(new StreamDataSource(new ByteArrayInputStream("hello".getBytes()))));
        me.setMessage(msg, "in");
        assertNotNull(((NormalizedMessageImpl) msg).getBody());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
View Full Code Here

Examples of org.apache.servicemix.jbi.util.StreamDataSource

  public void setContentType(String contentType) {
    this.contentType = contentType;
  }

    public void readMessage(MessageExchange exchange, NormalizedMessage message, InputStream in, String path) throws IOException, JBIException {
      DataSource ds = new StreamDataSource(in, contentType);
      DataHandler handler = new DataHandler(ds);
      message.addAttachment(attachment, handler);
        message.setProperty(FILE_NAME_PROPERTY, new File(path).getName());
        message.setProperty(FILE_PATH_PROPERTY, path);
    }
View Full Code Here

Examples of org.apache.servicemix.jbi.util.StreamDataSource

        me.setOperation(new QName("uri", "op"));
        me.setProperty("myProp", "myValue");
        NormalizedMessage msg = me.createMessage();
        msg.setProperty("myMsgProp", "myMsgValue");
        msg.setContent(src);
        msg.addAttachment("myAttachment", new DataHandler(new StreamDataSource(new ByteArrayInputStream("hello".getBytes()))));
        me.setMessage(msg, "in");
        assertNotNull(((NormalizedMessageImpl) msg).getBody());
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.