org.dspace.content.Bitstream.getChecksum()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(192)

本文整理了Java中org.dspace.content.Bitstream.getChecksum()方法的一些代码示例,展示了Bitstream.getChecksum()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bitstream.getChecksum()方法的具体详情如下:
包路径:org.dspace.content.Bitstream
类名称:Bitstream
方法名:getChecksum

Bitstream.getChecksum介绍

[英]Get the checksum of the content of the bitstream, for integrity checking
[中]获取位流内容的校验和,以进行完整性检查

代码示例

代码示例来源:origin: DSpace/DSpace

@Override
  public String getBitstreamProvenanceMessage(Context context, Item myitem)
    throws SQLException {
    // Get non-internal format bitstreams
    List<Bitstream> bitstreams = itemService.getNonInternalBitstreams(context, myitem);

    // Create provenance description
    StringBuilder myMessage = new StringBuilder();
    myMessage.append("No. of bitstreams: ").append(bitstreams.size()).append("\n");

    // Add sizes and checksums of bitstreams
    for (Bitstream bitstream : bitstreams) {
      myMessage.append(bitstream.getName()).append(": ")
           .append(bitstream.getSizeBytes()).append(" bytes, checksum: ")
           .append(bitstream.getChecksum()).append(" (")
           .append(bitstream.getChecksumAlgorithm()).append(")\n");
    }

    return myMessage.toString();
  }
}

代码示例来源:origin: DSpace/DSpace

private MediaResource getBitstreamResource(Context context,
                      Bitstream bitstream)
  throws SwordServerException, SwordAuthException {
  try {
    InputStream stream = bitstreamService.retrieve(context, bitstream);
    MediaResource mr = new MediaResource(stream,
                       bitstream.getFormat(context).getMIMEType(), null, true);
    mr.setContentMD5(bitstream.getChecksum());
    mr.setLastModified(this.getLastModified(context, bitstream));
    return mr;
  } catch (IOException | SQLException e) {
    throw new SwordServerException(e);
  } catch (AuthorizeException e) {
    throw new SwordAuthException(e);
  }
}

代码示例来源:origin: DSpace/DSpace

.append("\n");
buf.append(msg("checksum")).append(" = ").append(
  info.getChecksum()).append("\n");
buf.append(msg("store-number")).append(" = ").append(
  info.getStoreNumber()).append("\n");

代码示例来源:origin: DSpace/DSpace

/**
   * Add the bitstream metadata to the item
   *
   * @param item      The item
   * @param bitstream The bitstream
   * @param type      The type of bitstream
   * @throws SQLException An exception that provides information on a database access error or other errors.
   */
  protected void addMetadata(Item item, Bitstream bitstream, String type) throws SQLException {
    String value = bitstream.getFormat(Curator.curationContext()).getMIMEType() + "##";
    value += bitstream.getName() + "##";
    value += bitstream.getSizeBytes() + "##";
    value += item.getHandle() + "##";
    value += bitstream.getSequenceID() + "##";
    value += bitstream.getChecksum() + "##";
    if (bitstream.getDescription() != null) {
      value += bitstream.getDescription();
    }
    itemService.addMetadata(Curator.curationContext(), item, "dc", "format", type, "en", value);
  }
}

代码示例来源:origin: DSpace/DSpace

String cks = bitstream.getChecksum();
String cka = bitstream.getChecksumAlgorithm();
if (cks != null && cka != null) {

代码示例来源:origin: DSpace/DSpace

String md = fixity.getChildTextTrim("messageDigest", PREMIS_NS);
String b_alg = bitstream.getChecksumAlgorithm();
String b_md = bitstream.getChecksum();
if (StringUtils.equals(alg, b_alg)) {
  if (StringUtils.equals(md, b_md)) {

代码示例来源:origin: org.dspace/dspace-xmlui-api

validityKey.append(bitstream.getSource());
validityKey.append(bitstream.getDescription());
validityKey.append(bitstream.getChecksum());
validityKey.append(bitstream.getChecksumAlgorithm());
validityKey.append(bitstream.getSize());

代码示例来源:origin: DSpace/DSpace

List<Bundle> bundles = myBitstream.getBundles();
long size = myBitstream.getSizeBytes();
String checksum = myBitstream.getChecksum() + " (" + myBitstream.getChecksumAlgorithm() + ")";
int assetstore = myBitstream.getStoreNumber();

代码示例来源:origin: DSpace/DSpace

if (bitstream.getChecksum() == null) {
  mostRecentChecksum.setCurrentChecksum("");
  mostRecentChecksum.setExpectedChecksum("");
} else {
  mostRecentChecksum.setCurrentChecksum(bitstream.getChecksum());
  mostRecentChecksum.setExpectedChecksum(bitstream.getChecksum());

代码示例来源:origin: DSpace/DSpace

CheckSum checkSum = new CheckSum();
checkSum.setCheckSumAlgorith(bitstream.getChecksumAlgorithm());
checkSum.setValue(bitstream.getChecksum());
this.setCheckSum(checkSum);

代码示例来源:origin: DSpace/DSpace

@Override
public Bitstream clone(Context context, Bitstream bitstream)
    throws SQLException {
  // Create a new bitstream with a new ID.
  Bitstream clonedBitstream = bitstreamDAO.create(context, new Bitstream());
  // Set the internal identifier, file size, checksum, and
  // checksum algorithm as same as the given bitstream.
  clonedBitstream.setInternalId(bitstream.getInternalId());
  clonedBitstream.setSizeBytes(bitstream.getSizeBytes());
  clonedBitstream.setChecksum(bitstream.getChecksum());
  clonedBitstream.setChecksumAlgorithm(bitstream.getChecksumAlgorithm());
  clonedBitstream.setFormat(bitstream.getBitstreamFormat());
  try {
    //Update our bitstream but turn off the authorization system since permissions
    //haven't been set at this point in time.
    context.turnOffAuthorisationSystem();
    update(context, clonedBitstream);
  } catch (AuthorizeException e) {
    log.error(e);
    //Can never happen since we turn off authorization before we update
  } finally {
    context.restoreAuthSystemState();
  }
  return clonedBitstream;
}

代码示例来源:origin: org.dspace/dspace-oai-api

this.makeUKDCTermsElement("checksum",
             bitstreams[k].getChecksumAlgorithm(),
             bitstreams[k].getChecksum(), metadata);

代码示例来源:origin: DSpace/DSpace

String cs = logoBs.getChecksum();
if (cs != null && csType != null) {
  try {

代码示例来源:origin: DSpace/DSpace

String cks = bit.getChecksum();
String cka = bit.getChecksumAlgorithm();
String oname = bit.getSource();

代码示例来源:origin: DSpace/DSpace

String cs = bitstream.getChecksum();
if (auth && cs != null && csType != null) {
  try {

代码示例来源:origin: org.dspace/dspace-xmlui-api

String checksum = bitstream.getChecksum();
long size = bitstream.getSize();

代码示例来源:origin: org.dspace/dspace-xmlui-api

String desc = bitstream.getDescription();
String algorithm = bitstream.getChecksumAlgorithm();
String checksum = bitstream.getChecksum();

相关文章