@yume-chan/adb
Version:
TypeScript implementation of Android Debug Bridge (ADB) protocol.
78 lines • 2.41 kB
JavaScript
import { BufferCombiner, BufferedReadableStream, Consumable, } from "@yume-chan/stream-extra";
import { AutoResetEvent } from "../../utils/index.js";
export class AdbSyncSocketLocked {
get position() {
return this.
}
constructor(writer, readable, bufferSize, lock) {
this.
this.
this.
this.
}
// `#combiner` will reuse the buffer, so we need to use the Consumable pattern
return Consumable.WritableStream.write(this.
}
async flush() {
try {
await this.
const buffer = this.
if (buffer) {
await this.
}
}
finally {
this.
}
}
async write(data) {
try {
await this.
for (const buffer of this.
await this.
}
}
finally {
this.
}
}
async readExactly(length) {
// The request may still be in the internal buffer.
// Call `flush` to send it before starting reading
await this.flush();
return await this.
}
release() {
// In theory, the writer shouldn't leave anything in the buffer,
// but to be safe, call `flush` to throw away any remaining data.
this.
this.
}
async close() {
await this.
}
}
export class AdbSyncSocket {
constructor(socket, bufferSize) {
this.
this.
}
async lock() {
await this.
return this.
}
async close() {
await this.
await this.
}
}
//# sourceMappingURL=socket.js.map