Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TKBulletinPost extends TKBulletin {
- public int postID = 0x00;
- public String poster = "";
- public int month = 0;
- public int year = 0;
- public String subject = "";
- public String text = "";
- public LinkedList<TKBulletinSubject> boards = new LinkedList<TKBulletinSubject>();
- public TKBulletinPost(TKMain main, int postID, String poster, int month, int year, String subject, String text) {
- super(main);
- this.postID = postID;
- this.poster = poster;
- this.month = month;
- this.year = year;
- this.subject = subject;
- this.text = text;
- }
- public byte[] getData() {
- try {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- bout.write(0x03);
- bout.write(0x03);
- bout.write(0x0);
- ByteBuffer bb = ByteBuffer.allocate(2);
- bb.putShort((short)postID);
- bout.write(bb.array());
- bout.write(poster.length());
- bout.write(poster.getBytes());
- bout.write(month);
- bout.write(year);
- bout.write(subject.length());
- bout.write(subject.getBytes());
- bb.clear();
- bb.putShort((short)text.length());
- bout.write(bb.array());
- bout.write(text.getBytes());
- bout.flush();
- //main.log(3,"data: " + TKPacket.toHexString(bout.toByteArray()));
- return bout.toByteArray();
- } catch(Exception ex) {
- main.log(3, "Error creating BB packet", ex);
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement