Rename TruncatingInputStream -> LimitedInputStream.

This commit is contained in:
Greyson Parrelli
2024-09-06 08:13:50 -04:00
committed by Cody Henthorne
parent a6767e4f8a
commit a8fb4eb21a
7 changed files with 55 additions and 47 deletions

View File

@@ -6,7 +6,7 @@
package org.whispersystems.signalservice.api.crypto;
import org.signal.core.util.stream.TruncatingInputStream;
import org.signal.core.util.stream.LimitedInputStream;
import org.signal.libsignal.protocol.InvalidMessageException;
import org.signal.libsignal.protocol.incrementalmac.ChunkSizeChoice;
import org.signal.libsignal.protocol.incrementalmac.IncrementalMacInputStream;
@@ -117,7 +117,7 @@ public class AttachmentCipherInputStream extends FilterInputStream {
InputStream inputStream = new AttachmentCipherInputStream(wrappedStream, parts[0], streamLength - BLOCK_SIZE - mac.getMacLength());
if (plaintextLength != 0) {
inputStream = new TruncatingInputStream(inputStream, plaintextLength);
inputStream = new LimitedInputStream(inputStream, plaintextLength);
}
return inputStream;
@@ -142,7 +142,7 @@ public class AttachmentCipherInputStream extends FilterInputStream {
InputStream inputStream = new AttachmentCipherInputStream(new FileInputStream(file), archivedMediaKeyMaterial.getCipherKey(), file.length() - BLOCK_SIZE - mac.getMacLength());
if (originalCipherTextLength != 0) {
inputStream = new TruncatingInputStream(inputStream, originalCipherTextLength);
inputStream = new LimitedInputStream(inputStream, originalCipherTextLength);
}
return inputStream;
@@ -179,7 +179,7 @@ public class AttachmentCipherInputStream extends FilterInputStream {
InputStream inputStream = new AttachmentCipherInputStream(wrappedStream, parts[0], file.length() - BLOCK_SIZE - mac.getMacLength());
if (plaintextLength != 0) {
inputStream = new TruncatingInputStream(inputStream, plaintextLength);
inputStream = new LimitedInputStream(inputStream, plaintextLength);
}
return inputStream;

View File

@@ -6,15 +6,13 @@
package org.whispersystems.signalservice.api.messages.multidevice;
import org.signal.core.util.stream.TruncatingInputStream;
import org.signal.core.util.stream.LimitedInputStream;
import org.signal.libsignal.protocol.IdentityKey;
import org.signal.libsignal.protocol.InvalidKeyException;
import org.signal.libsignal.protocol.InvalidMessageException;
import org.signal.libsignal.protocol.logging.Log;
import org.signal.libsignal.zkgroup.InvalidInputException;
import org.signal.libsignal.zkgroup.profiles.ProfileKey;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentStream;
import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.push.ServiceId.ACI;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
@@ -62,7 +60,7 @@ public class DeviceContactsInputStream extends ChunkedInputStream {
if (details.avatar != null && details.avatar.length != null) {
long avatarLength = details.avatar.length;
InputStream avatarStream = new TruncatingInputStream(in, avatarLength);
InputStream avatarStream = new LimitedInputStream(in, avatarLength);
String avatarContentType = details.avatar.contentType != null ? details.avatar.contentType : "image/*";
avatar = Optional.of(new DeviceContactAvatar(avatarStream, avatarLength, avatarContentType));