Index: pkg/analysis_server/lib/src/services/index/store/split_store.dart |
diff --git a/pkg/analysis_server/lib/src/services/index/store/split_store.dart b/pkg/analysis_server/lib/src/services/index/store/split_store.dart |
index fc1ca31616d9a87571296627fddb1db75f9af3d2..7e65c174d0d5d389e738d98320d9ac51bf3aad4c 100644 |
--- a/pkg/analysis_server/lib/src/services/index/store/split_store.dart |
+++ b/pkg/analysis_server/lib/src/services/index/store/split_store.dart |
@@ -6,7 +6,6 @@ library services.src.index.store.split_store; |
import 'dart:async'; |
import 'dart:collection'; |
-import 'dart:io'; |
import 'dart:typed_data'; |
import 'package:analysis_server/src/services/index/index.dart'; |
@@ -988,7 +987,7 @@ class _DataInputStream { |
} |
int readInt() { |
- int result = _byteData.getInt32(_byteOffset); |
+ int result = _byteData.getInt32(_byteOffset, Endianness.HOST_ENDIAN); |
_byteOffset += 4; |
return result; |
} |
@@ -996,16 +995,23 @@ class _DataInputStream { |
class _DataOutputStream { |
- BytesBuilder _buffer = new BytesBuilder(); |
+ static const LIST_SIZE = 1024; |
+ int _size = LIST_SIZE; |
+ Uint32List _buf = new Uint32List(LIST_SIZE); |
+ int _pos = 0; |
Uint8List getBytes() { |
- return new Uint8List.fromList(_buffer.takeBytes()); |
+ return new Uint8List.view(_buf.buffer, 0, _size << 2); |
} |
void writeInt(int value) { |
- _buffer.addByte((value & 0xFF000000) >> 24); |
- _buffer.addByte((value & 0x00FF0000) >> 16); |
- _buffer.addByte((value & 0x0000FF00) >> 8); |
- _buffer.addByte(value & 0xFF); |
+ if (_pos == _size) { |
+ int newSize = _size << 1; |
+ Uint32List newBuf = new Uint32List(newSize); |
+ newBuf.setRange(0, _size, _buf); |
+ _size = newSize; |
+ _buf = newBuf; |
+ } |
+ _buf[_pos++] = value; |
} |
} |