Package com.tivo.hme.sdk.io

Examples of com.tivo.hme.sdk.io.ChunkedInputStream


       
        // flush any data that was generated from previous handling of
        // event
        flush();

        ChunkedInputStream chunkInStr = null;
        if (in instanceof ChunkedInputStream)
        {
            chunkInStr = (ChunkedInputStream)in;
        }
        else
        {
            chunkInStr = new ChunkedInputStream(in); //, IHmeConstants.TCP_BUFFER_SIZE);
        }

        if ( protocolVersion < VERSION_0_40 )
        {
            chunkInStr.setUseVString( false );
        }
        else {
            chunkInStr.setUseVString( true );
        }           

        int opcode = -1;
        try {
            opcode = (int)chunkInStr.readVInt();
        } catch (IOException e) {
            // receiver closed - ignore
        }

        if (opcode == -1) {
            doMore = false;
            return doMore;
        }
       
        HmeEvent evt = null;
        try
        {
            switch (opcode) {
              case EVT_DEVICE_INFO: evt = new HmeEvent.DeviceInfo(chunkInStr); break;
              case EVT_APP_INFO:   
                  evt = new HmeEvent.ApplicationInfo(chunkInStr);
                  initApp();
                  break;
                 
              case EVT_RSRC_INFO:   evt = new HmeEvent.ResourceInfo(chunkInStr, this); break;
              case EVT_KEY:         evt = new HmeEvent.Key(chunkInStr); break;
              case EVT_IDLE:        evt = new HmeEvent.Idle(chunkInStr); break;
              case EVT_FONT_INFO:  
                  evt = new HmeEvent.FontInfo(chunkInStr);
                  initApp();
                  break;
                 
              case EVT_INIT_INFO:  
                  evt = new HmeEvent.InitInfo(chunkInStr);
                  initApp();
                  break;
                 
              case ResolutionInfo.EVT_RES_INFO:
                  log.debug("handleChunk: ResolutionInfo");
                  this.resolutionInfo = new ResolutionInfo(chunkInStr);
                  evt = resolutionInfo;
                  Resolution res = resolutionInfo.getCurrentResolution();
                  if(res.getWidth() != getRoot().getWidth() || res.getHeight() != getRoot().getHeight())
                  {
                      getRoot().setSize(res.getWidth(), res.getHeight());
                      width = getRoot().getWidth();
                      height = getRoot().getHeight();
                      rootBoundsChanged(getRoot().getBounds());
                  }
                  resolutionReceived = true;
                  initApp();
                  break;
            }
            chunkInStr.readTerminator();
        }
        catch (IOException e) {
            evt = null;
            e.printStackTrace();
        }
View Full Code Here

TOP

Related Classes of com.tivo.hme.sdk.io.ChunkedInputStream

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.