Mercurial Hosting > luan
comparison src/org/eclipse/jetty/io/JBuffer.java @ 1051:1ab2dd0a7db5
remove JBuffer.get(int)
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 08 Nov 2016 00:18:45 -0700 |
parents | 5ef954fad97b |
children | 4a2489f1d5fe |
comparison
equal
deleted
inserted
replaced
1050:5ef954fad97b | 1051:1ab2dd0a7db5 |
---|---|
87 | 87 |
88 public int space() { | 88 public int space() { |
89 return bb.capacity() - bb.limit(); | 89 return bb.capacity() - bb.limit(); |
90 } | 90 } |
91 | 91 |
92 | |
93 public JBuffer get(int length) { | |
94 ByteBuffer dup = bb.duplicate(); | |
95 int end = bb.position()+length; | |
96 dup.limit(end); | |
97 bb.position(end); | |
98 return new JBuffer(dup); | |
99 } | |
100 | 92 |
101 public int get(byte[] b, int offset, int length) { | 93 public int get(byte[] b, int offset, int length) { |
102 int remaining = bb.remaining(); | 94 int remaining = bb.remaining(); |
103 if( remaining == 0 ) | 95 if( remaining == 0 ) |
104 return -1; | 96 return -1; |
149 | 141 |
150 public void setPutIndex(int putIndex) { | 142 public void setPutIndex(int putIndex) { |
151 bb.limit(putIndex); | 143 bb.limit(putIndex); |
152 } | 144 } |
153 | 145 |
154 public int skip(int n) { | 146 public void skip(int n) { |
155 if (remaining() < n) n = remaining(); | 147 if (remaining() < n) n = remaining(); |
156 bb.position(bb.position() + n); | 148 bb.position(bb.position() + n); |
157 return n; | |
158 } | 149 } |
159 | 150 |
160 public int readFrom(InputStream in,int max) throws IOException { | 151 public int readFrom(InputStream in,int max) throws IOException { |
161 ByteBuffer dup = bb.duplicate(); | 152 ByteBuffer dup = bb.duplicate(); |
162 int put = bb.limit(); | 153 int put = bb.limit(); |