All pastes #388897 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-10 11:06 UTC
rendered paste body
    private void readMessage(BufferedInputStream in) throws IOException {
        byte majop, minop; //major and minor ops
        
        smj.log("Reading message...");
        
        majop = (byte) in.read();
        minop = (byte) in.read();
        smj.log(String.valueOf(majop));
        smj.log(String.valueOf(minop));
        
        
        if(majop==NetConstants.AVATAR) {
            if(minop==NetConstants.INITIAL) {
                byte[] buf = new byte[128];
                int read = -1;
                do {
                    read++;
                    buf[read] = (byte) in.read();
                } while (buf[read] != 0);
                float x = Float.valueOf(new String(buf));

                //buf = new byte[0];
                Arrays.fill(buf, (byte) 0);
                read = -1;
                do {
                    read++;
                    buf[read] = (byte) in.read();
                } while (buf[read] != 0);
                // Do character encoding check thing
                float y = Float.valueOf(new String(buf));
                
                //String xin = scr.next(numberPattern);
                //String yin = scr.next(numberPattern);
                //float x = Float.valueOf(xin);
                //float y = Float.valueOf(yin);
                networkCallback.setAvatarLocation(x, y);
            }
        }