Source code: jcsq/PacketStripper.java
1 package jcsq;
2
3 public abstract class PacketStripper{
4
5 protected byte[] bytes;
6 public PacketStripper(byte[] b){
7 bytes = b;
8 }
9
10 protected byte[] strip(byte[] b, int offset){
11 byte[] ret = new byte[b.length-(offset-1)];
12 int c = 0;
13 for(int i=0;i<b.length;i++){
14 if(i>offset){
15 ret[c] = b[i];
16 c++;
17 }
18 }
19 return ret;
20 }
21
22 protected void strip(int offset){
23 byte[] ret = new byte[this.bytes.length-(offset-1)];
24 int c = 0;
25 for(int i=0;i<this.bytes.length;i++){
26 if(i>offset){
27 ret[c] = this.bytes[i];
28 c++;
29 }
30 }
31 this.bytes = ret;
32 }
33 }