use of suite.primitive.Bytes.BytesBuilder in project suite by stupidsing.
the class SocketServer method read.
private Bytes read(InputStream is, int max) throws IOException {
BytesBuilder bb = new BytesBuilder();
byte[] buffer = new byte[Constants.bufferSize];
int nBytesRead;
while ((nBytesRead = is.read(buffer, 0, min(max - bb.size(), buffer.length))) != -1) {
bb.append(buffer, 0, nBytesRead);
if (max < bb.size())
Fail.t("input too long");
}
return bb.toBytes();
}
use of suite.primitive.Bytes.BytesBuilder in project suite by stupidsing.
the class FileSystemKeyUtil method toName.
public Bytes toName(List<NameKey> keys) {
BytesBuilder bb = new BytesBuilder();
for (NameKey key : keys) if (0 < key.size)
bb.append(key.path.range(0, key.size));
else
bb.append(key.path);
return bb.toBytes();
}
Aggregations