1 module hunt.http.codec.websocket.frame.ReadOnlyDelegatedFrame; 2 3 import hunt.http.WebSocketFrame; 4 import hunt.io.ByteBuffer; 5 6 /** 7 * Immutable, Read-only, WebSocketFrame implementation. 8 */ 9 class ReadOnlyDelegatedFrame : WebSocketFrame { 10 private WebSocketFrame frame; 11 12 this(WebSocketFrame frame) { 13 this.frame = frame; 14 } 15 16 override 17 byte[] getMask() { 18 return frame.getMask(); 19 } 20 21 override 22 byte getOpCode() { 23 return frame.getOpCode(); 24 } 25 26 override 27 ByteBuffer getPayload() { 28 if (!frame.hasPayload()) { 29 return null; 30 } 31 return frame.getPayload(); 32 } 33 34 override 35 int getPayloadLength() { 36 return frame.getPayloadLength(); 37 } 38 39 override 40 WebSocketFrameType getType() { 41 return frame.getType(); 42 } 43 44 override 45 bool hasPayload() { 46 return frame.hasPayload(); 47 } 48 49 override 50 bool isFin() { 51 return frame.isFin(); 52 } 53 54 override 55 bool isMasked() { 56 return frame.isMasked(); 57 } 58 59 override 60 bool isRsv1() { 61 return frame.isRsv1(); 62 } 63 64 override 65 bool isRsv2() { 66 return frame.isRsv2(); 67 } 68 69 override 70 bool isRsv3() { 71 return frame.isRsv3(); 72 } 73 }