OLD | NEW |
1 part of swarmlib; | |
2 | |
3 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
4 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
5 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
6 | 4 |
7 // TODO(jimhug): Fill out methods, add encoder, move to shared lib. | 5 // TODO(jimhug): Fill out methods, add encoder, move to shared lib. |
8 class Decoder { | 6 class Decoder { |
9 int index; | 7 int index; |
10 String data; | 8 String data; |
11 | 9 |
12 Decoder(this.data) { | 10 Decoder(this.data) { |
(...skipping 21 matching lines...) Expand all Loading... |
34 } | 32 } |
35 | 33 |
36 String readString() { | 34 String readString() { |
37 int len = readInt(); | 35 int len = readInt(); |
38 String s = data.substring(index, index+len); | 36 String s = data.substring(index, index+len); |
39 index += len; | 37 index += len; |
40 return s; | 38 return s; |
41 } | 39 } |
42 } | 40 } |
43 | 41 |
OLD | NEW |