| 24 | import packetproxy.quic.value.SimpleBytes; |
| 25 | |
| 26 | @Value |
| 27 | public class RawFrame implements Frame { |
| 28 | |
| 29 | public static final long TYPE = 0x123456; |
| 30 | |
| 31 | public static List<Long> supportedTypes() { |
| 32 | return ImmutableList.of(TYPE); |
| 33 | } |
| 34 | |
| 35 | public static RawFrame of(byte[] bytes) { |
| 36 | return new RawFrame(bytes); |
| 37 | } |
| 38 | |
| 39 | public static RawFrame parse(byte[] bytes) { |
| 40 | return of(bytes); |
| 41 | } |
| 42 | |
| 43 | public static RawFrame parse(ByteBuffer buffer) { |
| 44 | byte[] frameData = SimpleBytes.parse(buffer, buffer.remaining()).getBytes(); |
| 45 | return new RawFrame(frameData); |
| 46 | } |
| 47 | |
| 48 | long type; |
| 49 | byte[] data; |
| 50 | |
| 51 | public RawFrame(byte[] frameData) { |
| 52 | this.type = TYPE; |
| 53 | this.data = frameData; |
| 54 | } |
| 55 | |
| 56 | @Override |
| 57 | public byte[] getBytes() throws Exception { |
| 58 | return this.data; |
| 59 | } |
| 60 | |
| 61 | @Override |
| 62 | public String toString() { |
| 63 | return String.format("RawFrame(data=[%s])", Hex.encodeHexString(this.data)); |
| 64 | } |
| 65 | |
| 66 | } |
nothing calls this directly
no outgoing calls
no test coverage detected