All pastes #756037 Raw Edit

Anonymous

public text v1 · immutable
#756037 ·published 2007-10-31 02:45 UTC
rendered paste body
public void takeSnapshot(){

       try {  
            
            String w,h,wh;
//            wh = mmcMenu.beallitasok.get("resoltion");
            //w = wh.substring(0,wh.indexOf("x"));
            
  //          h = wh.substring(w.length()+1,wh.length());
            // "encoding=jpeg&width="+w+"&height="+h
 // byteImage = vc.getSnapshot(null);
InputStream is = getClass().getResourceAsStream("/duke.png");

byte[] imageData = null;
try {
ByteArrayOutputStream bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = is.read()) != -1) {
bStrm.write(ch);
}

imageData = bStrm.toByteArray();
} catch (IOException io) {
io.printStackTrace();
} finally {
if (is != null)
is.close();
} 
    
           //myImage = Image.createImage(byteImage, 0, byteImage.length);

           //myDisplay.setCurrent(myImageCanvas);

           byteImage = imageData;
           
           
           
           
           
           
           //ClientSession sajt = new Connector().open();
        
                 
           
           
           
           
    String adr = "btgoep://00027207698F:4";
   
    ClientSession cs = (ClientSession) Connector.open (adr);
    HeaderSet hs = cs.connect(cs.createHeaderSet());
    cs.connect(hs);
    
    
    hs.setHeader(HeaderSet.LENGTH, new Long(byteImage.length));
    hs.setHeader(HeaderSet.NAME, "ize.jpeg");
    hs.setHeader(HeaderSet.TYPE, "image/jpeg");
    Operation po = cs.get(hs);
     
    po.sendHeaders(hs);
    OutputStream pout =  po.openOutputStream();
    
    pout.write(byteImage);
    pout.flush();
   
    po.close();
    cs.disconnect(null);
    cs.close();

  
         }catch( Exception e ) {
          e.printStackTrace();
          }
  
  
        }
    
     /**
      * PlayerListener Interface method, logs all player event.
      */
     public void playerUpdate(Player player, String event, Object eventData){
        log(" ** playerUpdate: " + event + " **");
       
     }