A question about switching between streams

Hi,
I am using a set of streams and readers in the following format to read from an ascii / binary mixed file. Once i read past all the ascii I break out of the loop and then use the data input stream to read som four byte floats from the binary data.
If you look at the extract from the file that lase piece of ascii that I read in is EST_Header_End. It is then followed by the floats. I know that the .. following the EST_Header_End is carraige return and new line. My problem is that when i start reading the floats i get NaN even though i know for a fact that the values following the .. are floats.The second float that it read in is definitely 1.0 . I cannot understand why this is happening. Surely if i start using a DataInputStream it should start at the same position as the BufferedReader left off.
fis = new FileInputStream(fileName);
bis = new BufferedInputStream(fis);
//allow a reader from a stream
isr = new InputStreamReader(bis);
//read the raw bytes
dis = new DataInputStream(bis);
//read the characters and strings
br = new BufferedReader(isr);EXTRACT FROM FILE
Channel_10 lpc_N..
EST_Header_End..
<..@?...K...>..;>.P.>...>.S:>....4f....}...."=...>...<._@?...K{s.>...>.U.>.L6>..<>....5.....4..0...
for(int k = 0; k < numFrames; k++){
     System.out.println( "reading track" );
     voice.diphone[index].frame[k].setframeTime(dis.readFloat());
     counter += 4;
     System.out.println( "time " + voice.diphone[index].frame[k].getFrameTime());
     voice.diphone[index].frame[k].setIsVal(dis.readFloat());
     System.out.println("isVal "+ voice.diphone[index].frame[k].getIsVal());
     voice.diphone[index].frame[k].setGain(dis.readFloat());
     System.out.println("isVal "+ voice.diphone[index].frame[k].getGain());
     counter += 4;
     for(int l = 0; l < (numChannels); l++){
          voice.diphone[index].frame[k].setValueLpc((dis.readFloat()),l);
          counter += 4;                               
          System.out.println("LPC coefficents at diphone "+ index +" " +"frame "+ k+" Lpc coefficent "+l+" " + voice.diphone[index].frame[k].getValueLpc(l));
}

I assume that you read
EST_Header_End..
with the BufferedReader, using readLine().
The problem is that when doing the readLine() (or any read for that matter) using BufferedReader, it's going to read more data than it needs and store those bytes in the BufferedReaderClass. Then when DataInputStream goes to read, it will not know this and read somewhere down the stream.
Probably, as unpleasant as this is, you need to layer the DataInputStream on top of the BufferedReader. Or maybe you can do something fancy with mark() and reset() altho, doubtful.
>
fis = new FileInputStream(fileName);
bis = new BufferedInputStream(fis);
//allow a reader from a stream
isr = new InputStreamReader(bis);
//read the raw bytes
dis = new DataInputStream(bis);
//read the characters and strings
br = new BufferedReader(isr);EXTRACT FROM FILE
Channel_10 lpc_N..
EST_Header_End..
<..@?...K...>..;>.P.>...>.S:>....4f....}...."=...>...<.
@?...K{s.>...>.U.>.L6>..<>....5.....4..0...
for(int k = 0; k < numFrames; k++){
     System.out.println( "reading track" );
     voice.diphone[index].frame[k].setframeTime(dis.readFlo
t());
     counter += 4;
System.out.println( "time " +
voice.diphone[index].frame[k].getFrameTime());
     voice.diphone[index].frame[k].setIsVal(dis.readFloat()
System.out.println("isVal "+
voice.diphone[index].frame[k].getIsVal());
     voice.diphone[index].frame[k].setGain(dis.readFloat())
System.out.println("isVal "+
voice.diphone[index].frame[k].getGain());
     counter += 4;
     for(int l = 0; l < (numChannels); l++){
          voice.diphone[index].frame[k].setValueLpc((dis.readFl
at()),l);
          counter += 4;                               
System.out.println("LPC coefficents at diphone "+
+ index +" " +"frame "+ k+" Lpc coefficent "+l+" " +
voice.diphone[index].frame[k].getValueLpc(l));

Similar Messages

  • (Agilent E3631A) Question about switching between channels

    Hi!
    I have got a problem with my Agilent E3631A. I want to control the machine into switching between +10V and -10V at given intervals of time. This should of course be achieved by switching between channel 2 and 3, but here the big problem arises: When the (+) and (-) are connected through the same wire, a current starts to pass from (-) to (+). I want to be able to completely close the channel that is not used a the time, thus making sure that the machine isn't short-circuiting the set up.
    Does anyone know how to "seal off" a channel?

    Hi Simon,
    as far as I know the 3 outputs of the power supply are independent.
    Have you tried to disable channel 3 through an SCPI command (or a driver VI) while enabling channel 2 and vice versa as you need it?
    I thought if disabling an output this one is then completely cut off, maybe it helps.
    Regards,
    gedi
    Regards,
    gedi

  • How to fast manual switching between streams in osmf plugin

    I just want to manual switching between streams using osmf plugin in custom player. For this I have use following code.
    mediaPlayer.autoDynamicStreamSwitch = false; mediaPlayer.switchDynamicStreamIndex(bitrateAdaptive.selectedIndex); mediaPlayer.addEventListener(DynamicStreamEvent.SWITCHING_CHANGE, onSwitchingChange);
    I am playing smil file streaming by wowza streaming server but code work but switch between streams very slow. It takes about 20 to seconds for switching which is not expected in this case.

    I just want to manual switching between streams using osmf plugin in custom player. For this I have use following code.
    mediaPlayer.autoDynamicStreamSwitch = false; mediaPlayer.switchDynamicStreamIndex(bitrateAdaptive.selectedIndex); mediaPlayer.addEventListener(DynamicStreamEvent.SWITCHING_CHANGE, onSwitchingChange);
    I am playing smil file streaming by wowza streaming server but code work but switch between streams very slow. It takes about 20 to seconds for switching which is not expected in this case.

  • Few questions about difference between Satellite P70 , L70, S70

    Hello, i have many questions about the series P70 , L70, S70 that come with a 1920x1080 panel.
    1) What are the differences between the L70 and S70 series? Except of the HDD capacity and RAM, the notebooks look pretty identical.
    2) Do P70 , L70, S70 support a 2nd HDD or is it just the P70 series that support it ?
    3) Do all three (P70, L70, S70 series) come with the same TFT Panels ?
    4) Which of the above series supports mSata ?
    5) Do all of the model of each series come with a mSata support? E.g. Could it be that L70-a-13m supports mSata while the L70-a-146 does not ?
    6) All of the above, come with a S-ATA II or S-ATA III interface ?
    7) Which is the best of those series listed ? I am trying to understand what makes the big difference from S70 to P70 except of the casing for example.
    Thank you in advance.

    >1) What are the differences between the L70 and S70 series? Except of the HDD capacity and RAM, the notebooks look pretty identical.
    What Sat L70 and S70 models do you mean exactly? There are different L70-xxx and S70-xxx models on the market which supports different hardware specifications.
    >2) Do P70 , L70, S70 support a 2nd HDD or is it just the P70 series that support it?
    As you can see in this [Sat P70 HDD replacement document,|http://aps2.toshiba-tro.de/kb0/CRU3903II0000R01.htm] the P70 series supports 2nd HDD bay BUT even if there is an 2nd HDD bay this does not mean that you could use 2nd HDD. In case the 2nd HDD bay would be equipped with HDD connector, you could use the 2nd HDD
    I found also the [Sat L70/S70 HDD replacement |http://aps2.toshiba-tro.de/kb0/CRU3703HG0000R01.htm] document on Toshiba page and there I can see that 2nd HDD bay is not available
    > 3) Do all three (P70, L70, S70 series) come with the same TFT Panels?
    See point 1). Different P70, L70, S70 models were equipped with different hardware parts.
    > 4) Which of the above series supports mSata?
    As far as I know only some P70 models are equipped with an 256GB mSATA-SSD.
    > 5) Do all of the model of each series come with a mSata support? E.g. Could it be that L70-a-13m supports mSata while the L70-a-146 does not ?
    See point 4) not all models supports the same hardware specifications
    > 6) All of the above, come with a S-ATA II or S-ATA III interface ?
    I dont think that SATA III is supported. I guess it would be SATA II
    > 7) Which is the best of those series listed ? I am trying to understand what makes the big difference from S70 to P70 except of the casing for example.
    Not easy to answer because there are too many models released in Europea.
    And not all models are available in each country. So I guess you will need to look for models which were released in your country.

  • Question about switching videos.

    Hello everyone!
    I would like to make a video player with the ability to
    switch between two different
    video files with a keystroke. It must loop the file forever
    until it reads the keystroke to switch.
    How can i do that? Dont have great experience with flash, im
    using flash cs3 on a mac.
    If someone could point me somewhere or explain i would be
    grateful.
    Thanks in advance

    lyons00,
    The legality of copying DVDs to another format, sometimes called "ripping", is a murky area legally, and outside the Terms of Use for Apple Discussions. Essentially when your purchase a movie, your purchase a license to play it at home on a DVD player. Playing it in front of an audience, or changing the format of it require a different license from whomever holds the distribution rights.
    Thank you,
    Nathan C.

  • Questions about input/output streams

    In the following tutorial:
    http://chortle.ccsu.ctstateu.edu/CS151/Notes/chap85/ch85_10.html
    It mentions that some methods, such as write(), writeByte(), writeBytes(), and writeChar(), return the low eight bits of the argument to the output stream. I am a little unsure of what exactly that means, might somebody be able to clarify for me?
    In addition, I've been encountering the flush() method in some of the byte- and character-streaming objects that deal with buffers. What exactly is the flush() method's purpose, and when might it be used? Thank you.

    flush pushes the data out of the buffer. the write methods write to the buffer, when the buffer is full, it flushes itself (usually), or it could block the write methods (in theory). flush just lets you make sure that it's flushed.
    I'm not sure there's any reason to worry about high and low bytes in Java most of the time. I suppose, like anything, there's times you need to, but I can't think of any offhand.

  • Question about switching from pc to mac

    I am going to be purchasing a new computer in March. I am seriously considering switching to a mac. I've owned a mac before and I obviously have my reasons for wanting to go back...however...I've always been a pc and all of my software is pc based...and a lot of them I no longer have the install discs for. I'm a designer and my main concern is losing the ability to use my software, such as Adobe CS4 because I dont' know if it will be compatible with the mac. My question is, is there a way to transfer my software from my pc to a mac without any external hard drives and without having to buy all new software for the new mac? This is going to be the deciding factor on whether or not I go with a mac instead of a new pc. I really could use some input on this. Thanks so much.

    If you've bought your Mac, be sure to exchange your Windows CS4 license before CS5 comes out. Adobe will only do a cross-platform swap on the current version (which I found out the hard way!)
    Take a look here: http://kb2.adobe.com/cps/405/kb405819.html
    I have heard of a lot of folks having trouble getting a cross-platform swap. Also, don't believe anything an Adobe customer support rep tells you. They are either "misinformed" or they flat-out lie.
    Best of luck!

  • Question about switching DPS accounts and In-App Purchases

    Here comes a tricky one
    I have my app published on Apple using an specific DPS account (aka [email protected]) and I have some in-app purchases into the app that the final users have already bought.
    For some reason, I need to switch the app to use a different DPS account (let's say  [email protected]) and I need to recompile the app and make it available on App Store (Apple Account will be the same one). Concerning the folios, I can upload them again with the same product ID as the older ones and delete the older folios from the older account.
    Question is:  What would happen to my In-App Purchases? Will I be able to restore my purchases if I have a new app with a different account? Will Adobe allow to use the same Product ID for another folio even if it was used previously?
    Hope you can help me out with this.

    Phone is now fixed and because the game was saved to my game centre, it loaded with all purchases. So I'm thinking that as long as the game is saved to game centre, it will reload as it was previously.

  • Question about connection between cache engine and cat6k

    Dear sir,
    Here is the problem description, please give me some help, thank you so much:
    catalyst 6509 is enable for wccp v2.CE 7320 also enable the wccp v2.Wccp service 91 is configured on 6509.Service-munber 91 and port-list 1(with port number 8080) are also configured on CE 7320.Wccp communicates well about service number 91.
    but browsing web page with port number 8080 gets always failed.
    1.6509 wccp configuration:
    ip wccp web-cache redirect-list 30
    ip wccp 91
    interface Vlan10
    ip address 211.162.224.2 255.255.255.240
    ip wccp web-cache redirect out
    ip wccp 91 redirect out
    2.ce7320 wccp configuration:
    wccp router-list 1 211.161.1.49
    wccp port-list 1 8080
    wccp web-cache router-list-num 1
    wccp service-number 91 router-list-num 1 port-list-num 1 application cache
    wccp version 2
    3.show info. from 6509 and ce 7320:
    gwbn7320#sh wccp content-engines
    Content Engine List for Service: Web Cache
    IP address = 211.161.1.50
    Routers seeing this Content Engine(1)
    211.162.224.2
    Content Engine List for Service: WCCPv2 Service 91
    IP address = 211.161.1.50
    Routers seeing this Content Engine(1)
    211.162.224.2
    gwbn7320#sh statistics http savings
    Statistics - Savings
    Requests Bytes
    Total: 90685 460066803
    Hits: 936 162710
    Miss: 89749 459904093
    Savings: 1.0 % 0.0 %
    6509-left#sh ip wccp
    Global WCCP information:
    Router information:
    Router Identifier: 211.162.224.2
    Protocol Version: 2.0
    Service Identifier: web-cache
    Number of Cache Engines: 1
    Number of routers: 1
    Total Packets Redirected: 2525
    Redirect access-list: 30
    Total Packets Denied Redirect: 0
    Total Packets Unassigned: 146
    Group access-list: -none-
    Total Messages Denied to Group: 0
    Total Authentication failures: 0
    Service Identifier: 91
    Number of Cache Engines: 1
    Number of routers: 1
    Total Packets Redirected: 0
    Redirect access-list: -none-
    Total Packets Denied Redirect: 0
    Total Packets Unassigned: 0
    Group access-list: -none-
    Total Messages Denied to Group: 0
    Total Authentication failures: 0
    Regards,
    Sha

    Gilles,
    Thank you!
    Here is the result:
    6509-left#sh ip wccp 91 detail
    WCCP Cache-Engine information:
    IP Address: 211.161.1.50
    Protocol Version: 2.0
    State: Usable
    Redirection: GRE
    Initial Hash Info: 00000000000000000000000000000000
    00000000000000000000000000000000
    Assigned Hash Info: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    Hash Allotment: 256 (100.00%)
    Packets Redirected: 180
    Connect Time: 00:07:06
    Regards,
    Sha

  • Newbie question about switch statement

    Lets say you have a loop and inside the loop you have a switch statement, how do you BREAK out of the outer loop?
    for (i=0....) {
    switch {
    case 11:
    .... some stuff
    break; <==== HOW DO I BREAK OUT OF THE for loop here?

    In standard C and standard C++ the break statement terminates the nearest enclosing loop and only that loop; i.e. control transfers to the first statement following the loop. I think there are C or C++ extensions that allow loop tags which may be used with a break to specify which loop to drop through, but I don't think these are supported by gcc, and they would certainly be very non-portable.
    There are several common ways to drop out of one or more outer loops. In many cases, there's nothing else in the loop following the switch so you can simply write
    switch (condition) {
    default:
    case 0:
    break;
    // other case statements here
    break;
    Else you can declare a loop control var and use the continue statement like this:
    for (i=0; i<jMax && !bDone; i++) {
    switch (condition) {
    default:
    case 0:
    bDone++; continue;
    // other case statements
    If you need to escape several loops and/or don't want to use loop control vars, you might consider structuring the code so you can use return to terminate the entire function. In the worst case of a very complex structure that you don't know how to simplify with a helper function, you can always resort to a goto:
    switch (condition) {
    default:
    case 0:
    goto escape;
    // other case statements here
    // remainder of code inside nested loops here
    escape: <first statement following the outermost loop>;
    Note that the statement following the escape label is always executed; i.e. when execution skips the goto it's as if the statement following escape was unlabeled. Use goto sparingly of course, since it's an artifact of unstructured programming. But when you really need a goto, it can make your code much easier to maintain.

  • Question about "switch" statement

    hi all I am new to Java programming..
    I have one problem that is
    I would like to use switch statement like below
    in the switch statement can we use only integers ?
    but i am using string it is not supporting ..
    for strings like below what I have to do...
    String temp = "str2";
    switch(temp){
    case "str1":
    case "str2":
    case "str3":
    case "str4":
    please send the solution if anyone knows
    thanks

    What do you mean by a smart hash?At least smarter than String.hashCode ().
    Don't think so - char, byte, short, or int.You're correct - seems I've got to test things before I post. So it's safe to say that a switch works on anything that can be treated as an int?

  • Question about transfer between oracle and sql server

    Could i program to transfer lots of data between Oracle and SQL Server quickly?
    I have tried make two connection between two databases, but it took me lots of time to transfer data.
    How could I do it?
    Thanks

    Hi,
    If you need to move data fast, then use the Oracle Migration Workbench to Generate SQL Server BCP data extraction scripts and Oracle SQL Loader files.
    This is the fastest way to migrate the data.
    In the Oracle Model UI tab of the Oracle Migration Workbench, right mouse click on the tables folder. there is a menu option to 'Generate SQL Loader ...' scripts. This will help you migrate your data efficiently.
    Regards
    John

  • Simple question about sockets and streams - please answer it!

    Hi
    I have a server socket and a client socket. Both are up and runing. But I'm having problems to send a string from the client and read only the four first bytes on the server. Please read the code and some other comments below:
    socket client:
    DataOutputStream out =
    new DataOutputStream(socket.getOutputStream());
    // read from keyboard input
    BufferedReader myinput =
    new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Type any 4 chars and [enter].");
    String any = myinput.readLine();
    out.writeBytes(any);
    out.flush();
    server socket:
    in = new DataInputStream(socket.getInputStream());
    byte[] id = new byte[4];
    in.read(id, 0, 4);
    System.out.print(new String(id));
    According to the code, it should read 4 bytes from the input stream (in.read(id, 0, 4)), but it displays only the first byte. For example, if I type "hello" on client, the serve should show "hell" but it shows just "h"
    Any ideias? Thanks!

    Hi,
    Check the Javadoc for 'in.read(id, 0, 4);' This reads up to 4 bytes and returns the number of bytes read. You need something along the lines of
    int count = 0;
    while (count < 4)
    count += in.read(id, count, 4-count);
    Roger

  • ISE question about switches

    I am implementing ISE and have run into several locations that have used consumer brand 4 ports switches to connect multiple workstations on one cable.  I realize there is a list of supported Cisco switches for ISE, but I was wondering if anyone has used a lower end Cisco or other vendor switch  (i.e. Cisco SG200-08 or SF300-08) to do basic authentication against ISE as it relates to enabling the port once the 802.1x authenitcation is passed?
    Realize this is a bit vague, just looking for anyone with practical experience with this.
    Thanks

    I have not configured dot1x for the mentioned switches, if the switches do support dot1x you should be able to do basic authentication. If there are multiple endpoints on the same port, you should use the Multi-Auth host mode on switchport. Also you will have to choose an authentication method that is supported by the endpoints.
    http://www.cisco.com/en/US/prod/collateral/switches/ps5718/ps11229/data_sheet_c78-634369.html
    • Network security:  Cisco 200 Series switches provide basic security and network management  features you need to maintain a level of security for your business,  keep unauthorized users off the network, and protect your business data.  The switches provide integrated network security to reduce the risk of a  security breach, with IEEE 802.1X port security to control access to  your network.
    and
    802.1X: RADIUS authentication and accounting, MD5 hash
    There wont be CoA and authorization, you may apply manual ACL on switchport for the controlled access.
    the answer to your post, yes you should be able to do basic dot1x authentication.
    HTH

  • Question about Workflow between Premiere and After Effects

    Hey guys, I have Production Premium CS5 (Premiere and AE)
    One thing that has always confused me was basic workflow between these 2 products.  Is it best to get your clips, but them into sequence, do the basic effects that Premiere supports and output into the  highest quality video in order to take into AE and apply effects to?
    Or should I take video footage, do my After Effects work, export that as a clip that will then be used in the video composition in Premiere?  I know I don't want to move a project too many times between because of compression, so what would the most optimized workflow be?
    FYI, I am doing a lot of video game frag movies, so I have a lot of effects I like to put into it.

    Really?
    I'm always amazed at Photoshop's cold boot startup time. On my rig it takes 8 seconds.  From a warm boot, Photoshop will start in 2-4 seconds.
    This isn't the case with my video editing software though...
    Sony Vegas 8.1 (looking to learn Premiere so I don't need this anymore - Cold Boot : 8 seconds, Warm Boot : 3 seconds)
    After Effects (Cold Boot : 22 seconds, Warm Boot : 8 seconds)
    Premiere (Cold Boot : 48 seconds, Warm Boot : 16 seconds)
    Premiere seems to be a beast of a program; I'm rather surprised, I thought AE would be the more intense one.  Sorry, I haven't yet overcome my fears of losing projects/data because I'm running on a Windows machine.
    It's half the reason why I have a Mozy account to backup my files to an online resource.

Maybe you are looking for

  • Etrecheck vs Activity Monitor

    Hi, I've noticed (and not for the first time, BTW) that the results of Etrecheck don't match those of Activity Monitor on my Mac (the pics below). For example, Etrecheck displays CPU use percentage as followings: for WindowServer 3% while Activity Mo

  • Remote Database Link

    I have to Database set up in 2 different machine. All are having rel 9.2.0.1.0 in them. I am trying to use private fixed database link to connect form one to another(from a 3rd client machine). say my orcale databases are: service_name for target dat

  • Java.lang.ClassCastException: com.bea.wsrp.producer.descriptor.DefaultPortl

    Hi All, I am getting the java.lang.ClassCastException: com.bea.wsrp.producer.descriptor.DefaultPortletDescriptor while loading a portlet from a portal. I could see the jar for this class is wsrp-producer.jar.Is this due to a jar issue.I cant debug as

  • Where is OCA605290.zip?

    I'm looking for the file in the cd and in the web but i can't get them . Where i can find this file, in FTP, HTTP, Email,please HELP ME!

  • Cursor Fetch into Record vs Record Components

    Anyone, What are pros and cons of the use of the cursor method that fatches into a single record value vs. that of record components? I am just not seeing why you might use one vs other so was curious if their is something I am missing in reagrds to