当前位置: 首页>>代码示例>>Java>>正文


Java DecryptingPartInputStream类代码示例

本文整理汇总了Java中org.thoughtcrime.securesms.crypto.DecryptingPartInputStream的典型用法代码示例。如果您正苦于以下问题:Java DecryptingPartInputStream类的具体用法?Java DecryptingPartInputStream怎么用?Java DecryptingPartInputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DecryptingPartInputStream类属于org.thoughtcrime.securesms.crypto包,在下文中一共展示了DecryptingPartInputStream类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readAt

import org.thoughtcrime.securesms.crypto.DecryptingPartInputStream; //导入依赖的package包/类
@Override
public int readAt(long position, byte[] bytes, int offset, int length) throws IOException {
  DecryptingPartInputStream inputStream     = new DecryptingPartInputStream(mediaFile, masterSecret);
  byte[]                    buffer          = new byte[4096];
  long                      headerRemaining = position;

  while (headerRemaining > 0) {
    int read = inputStream.read(buffer, 0, Util.toIntExact(Math.min((long)buffer.length, headerRemaining)));

    if (read == -1) return -1;

    headerRemaining -= read;
  }

  int returnValue = inputStream.read(bytes, offset, length);
  inputStream.close();
  return returnValue;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:19,代码来源:EncryptedMediaDataSource.java

示例2: readAt

import org.thoughtcrime.securesms.crypto.DecryptingPartInputStream; //导入依赖的package包/类
@Override
public int readAt(long position, byte[] bytes, int offset, int length) throws IOException {
  InputStream inputStream     = DecryptingPartInputStream.createFor(masterSecret, mediaFile);
  byte[]      buffer          = new byte[4096];
  long        headerRemaining = position;

  while (headerRemaining > 0) {
    int read = inputStream.read(buffer, 0, Util.toIntExact(Math.min((long)buffer.length, headerRemaining)));

    if (read == -1) return -1;

    headerRemaining -= read;
  }

  int returnValue = inputStream.read(bytes, offset, length);
  inputStream.close();
  return returnValue;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:19,代码来源:EncryptedMediaDataSource.java

示例3: getDataStream

import org.thoughtcrime.securesms.crypto.DecryptingPartInputStream; //导入依赖的package包/类
@VisibleForTesting
protected @Nullable InputStream getDataStream(MasterSecret masterSecret, AttachmentId attachmentId, String dataType)
{
  File dataFile = getAttachmentDataFile(attachmentId, dataType);

  try {
    if (dataFile != null) return new DecryptingPartInputStream(dataFile, masterSecret);
    else                  return null;
  } catch (FileNotFoundException e) {
    Log.w(TAG, e);
    return null;
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:14,代码来源:AttachmentDatabase.java

示例4: getSize

import org.thoughtcrime.securesms.crypto.DecryptingPartInputStream; //导入依赖的package包/类
@Override
public long getSize() throws IOException {
  DecryptingPartInputStream inputStream = new DecryptingPartInputStream(mediaFile, masterSecret);
  byte[]                    buffer      = new byte[4096];
  long                      size        = 0;

  int read;

  while ((read = inputStream.read(buffer)) != -1) {
    size += read;
  }

  return size;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:15,代码来源:EncryptedMediaDataSource.java

示例5: getDataStream

import org.thoughtcrime.securesms.crypto.DecryptingPartInputStream; //导入依赖的package包/类
@VisibleForTesting
protected @Nullable InputStream getDataStream(MasterSecret masterSecret, AttachmentId attachmentId, String dataType)
{
  File dataFile = getAttachmentDataFile(attachmentId, dataType);

  try {
    if (dataFile != null) return DecryptingPartInputStream.createFor(masterSecret, dataFile);
    else                  return null;
  } catch (IOException e) {
    Log.w(TAG, e);
    return null;
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:14,代码来源:AttachmentDatabase.java

示例6: getSize

import org.thoughtcrime.securesms.crypto.DecryptingPartInputStream; //导入依赖的package包/类
@Override
public long getSize() throws IOException {
  InputStream inputStream = DecryptingPartInputStream.createFor(masterSecret, mediaFile);
  byte[]      buffer      = new byte[4096];
  long        size        = 0;

  int read;

  while ((read = inputStream.read(buffer)) != -1) {
    size += read;
  }

  return size;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:15,代码来源:EncryptedMediaDataSource.java

示例7: getStream

import org.thoughtcrime.securesms.crypto.DecryptingPartInputStream; //导入依赖的package包/类
public @NonNull InputStream getStream(MasterSecret masterSecret, long id) throws IOException {
  final byte[] cached = cache.get(id);
  return cached != null ? new ByteArrayInputStream(cached)
                        : new DecryptingPartInputStream(getFile(id), masterSecret);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:6,代码来源:PersistentBlobProvider.java

示例8: getStream

import org.thoughtcrime.securesms.crypto.DecryptingPartInputStream; //导入依赖的package包/类
public @NonNull InputStream getStream(MasterSecret masterSecret, long id) throws IOException {
  final byte[] cached = cache.get(id);
  return cached != null ? new ByteArrayInputStream(cached)
                        : DecryptingPartInputStream.createFor(masterSecret, getFile(id));
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:6,代码来源:PersistentBlobProvider.java

示例9: getPartInputStream

import org.thoughtcrime.securesms.crypto.DecryptingPartInputStream; //导入依赖的package包/类
private InputStream getPartInputStream(MasterSecret masterSecret, File path)
    throws FileNotFoundException
{
  Log.w(TAG, "Getting part at: " + path.getAbsolutePath());
  return new DecryptingPartInputStream(path, masterSecret);
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:7,代码来源:PartDatabase.java


注:本文中的org.thoughtcrime.securesms.crypto.DecryptingPartInputStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。