Package net.bnubot.core

Examples of net.bnubot.core.BNetOutputStream


  }
 
  public void SendPacket(OutputStream out, boolean packetLog) {
    byte data[] = ((ByteArrayOutputStream)this.out).toByteArray();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BNetOutputStream sckout = new BNetOutputStream(baos);
   
    try {
      sckout.writeWord(data.length + 3);
      sckout.writeByte(packetId);
      sckout.write(data);
    } catch(IOException e) {
      e.printStackTrace();
      System.exit(1);
    }
   
View Full Code Here


    for(int i = 0; i < packetLength-3; i++) {
      data[i] = is.readByte();
    }
   
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BNetOutputStream os = new BNetOutputStream(baos);
    os.writeByte(packetId);
    os.writeWord(packetLength);
    os.write(data);
   
    if(packetLog)
      Out.info("MCPPacketReader", "RECV MCP\n" + HexDump.hexDump(baos.toByteArray()));
  }
View Full Code Here

    for(int i = 0; i < packetLength-4; i++) {
      data[i] = is.readByte();
    }
   
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BNetOutputStream os = new BNetOutputStream(baos);
    os.writeByte(0xFF);
    os.writeByte(packetId);
    os.writeWord(packetLength);
    os.write(data);
   
    if(packetLog)
      Out.info(this.getClass().getName(), "RECV\n" + HexDump.hexDump(baos.toByteArray()));
  }
View Full Code Here

 
  public void SendPacket(OutputStream out, boolean packetLog) throws IOException, SocketException {
    byte data[] = ((ByteArrayOutputStream)this.out).toByteArray();
    //BNCSOutputStream sckout = new BNCSOutputStream(out);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BNetOutputStream sckout = new BNetOutputStream(baos);
   
    if(packetId == BNCSCommandIDs.SID_CHATCOMMAND) {
      if(data.length > 0xFB) {
        Out.error(this.getClass().getName(), "Chat command is too long; ignoring.");
        return;
      }
      if(data[data.length-1] != 0x00) {
        Out.error(this.getClass().getName(), "Chat command is not null terminated; ignoring.");
        return;
      }
    }
   
    try {
      sckout.writeByte(0xFF);
      sckout.writeByte(packetId);
      sckout.writeWord(data.length + 4);
      sckout.write(data);
    } catch(IOException e) {
      e.printStackTrace();
      System.exit(1);
    }
   
View Full Code Here

TOP

Related Classes of net.bnubot.core.BNetOutputStream

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.