1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.eclipse.jetty.spdy.frames;
15
16 import org.eclipse.jetty.spdy.api.DataInfo;
17
18 public class DataFrame
19 {
20 public static final int HEADER_LENGTH = 8;
21
22 private final int streamId;
23 private final byte flags;
24 private final int length;
25
26 public DataFrame(int streamId, byte flags, int length)
27 {
28 this.streamId = streamId;
29 this.flags = flags;
30 this.length = length;
31 }
32
33 public int getStreamId()
34 {
35 return streamId;
36 }
37
38 public byte getFlags()
39 {
40 return flags;
41 }
42
43 public int getLength()
44 {
45 return length;
46 }
47
48 public boolean isClose()
49 {
50 return (flags & DataInfo.FLAG_CLOSE) == DataInfo.FLAG_CLOSE;
51 }
52
53 public boolean isCompress()
54 {
55 return (flags & DataInfo.FLAG_COMPRESS) == DataInfo.FLAG_COMPRESS;
56 }
57
58 @Override
59 public String toString()
60 {
61 return String.format("DATA frame stream=%d length=%d close=%b compress=%b", getStreamId(), getLength(), isClose(), isCompress());
62 }
63 }