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

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

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

Bitstream.getSizeBytes介绍

[英]Get the size of the bitstream
[中]获取比特流的大小

代码示例

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

public long getSize() {
  return bitstream.getSizeBytes();
}

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

/**
 * Compares two bitstreams based on their mimetypes, if mimetypes are the same,then the largest bitstream comes
 * first
 * See google-metadata.properties to define the order
 *
 * @param b1 first bitstream
 * @param b2 second bitstream
 * @return
 */
public int compare(Bitstream b1, Bitstream b2) {
  int priority1 = getPriorityFromBitstream(b1);
  int priority2 = getPriorityFromBitstream(b2);
  if (priority1 > priority2) {
    return 1;
  } else if (priority1 == priority2) {
    if (b1.getSizeBytes() <= b2.getSizeBytes()) {
      return 1;
    } else {
      return -1;
    }
  } else {
    return -1;
  }
}

代码示例来源: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

buf.append(msg("name")).append(" = ").append(info.getName())
  .append("\n");
buf.append(msg("size")).append(" = ").append(info.getSizeBytes())
  .append("\n");
buf.append(msg("source")).append(" = ").append(info.getSource())

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

size.setText(String.valueOf(bitstream.getSizeBytes()));
ochar.addContent(size);

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

.getID() + " from assetstore[" + assetstoreSource + "] to assetstore[" + assetstoreDestination + "] " +
     "Name:" + bitstream
.getName() + ", SizeBytes:" + bitstream.getSizeBytes());

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

static int countBitstreamSmallerThanMinSize(Context context, BundleName bundleName, Item item, String[] mimeList,
                      String prop) {
  long size = DSpaceServicesFactory.getInstance().getConfigurationService().getLongProperty(prop);
  int count = 0;
  try {
    for (Bundle bundle : item.getBundles()) {
      if (!bundle.getName().equals(bundleName.name())) {
        continue;
      }
      for (Bitstream bit : bundle.getBitstreams()) {
        for (String mime : mimeList) {
          if (bit.getFormat(context).getMIMEType().equals(mime.trim())) {
            if (bit.getSizeBytes() < size) {
              count++;
            }
          }
        }
      }
    }
  } catch (SQLException e) {
    // ignore
  }
  return count;
}

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

.append(bitstream.getID()).append(") to Zip: ")
                       .append(zname).append(", size=")
                       .append(bitstream.getSizeBytes()).toString());
      ze.setSize(auth ? bitstream.getSizeBytes() : 0);
      zip.putNextEntry(ze);
      if (auth) {
      String.valueOf(logoBs.getID()),
      zname,
      String.valueOf(logoBs.getSizeBytes()));
ze.setSize(logoBs.getSizeBytes());

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

static int countBitstreamLargerThanMaxSize(Context context, BundleName bundleName, Item item, String[] mimeList,
                      String prop) {
  long size = DSpaceServicesFactory.getInstance().getConfigurationService().getLongProperty(prop);
  int count = 0;
  try {
    for (Bundle bundle : item.getBundles()) {
      if (!bundle.getName().equals(bundleName.name())) {
        continue;
      }
      for (Bitstream bit : bundle.getBitstreams()) {
        for (String mime : mimeList) {
          if (bit.getFormat(context).getMIMEType().equals(mime.trim())) {
            if (bit.getSizeBytes() > size) {
              count++;
            }
          }
        }
      }
    }
  } catch (SQLException e) {
    // ignore
  }
  return count;
}

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

try {
  int size = Integer.parseInt(ssize);
  if (bitstream.getSizeBytes() != size) {
    throw new MetadataValidationException(
      "Bitstream size (" + String.valueOf(bitstream.getSizeBytes()) +
        ") does not match size in PREMIS (" + ssize + "), rejecting it.");

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

for (Bitstream bitstream : bitstreams) {
        size += bitstream.getSizeBytes();
    for (Bitstream bitstream : bitstreams) {
      size += bitstream.getSizeBytes();
for (Bitstream bitstream : bitstreams) {
  size += bitstream.getSizeBytes();

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

LOG.info(msg("name") + ": " + bitstream.getName());
LOG.info(msg("store-number") + ": " + bitstream.getStoreNumber());
LOG.info(msg("size") + ": " + bitstream.getSizeBytes());
LOG.info(msg("bitstream-format") + ": " + (bitstream.getFormat(context) != null ? bitstream.getFormat(context)
                                              .getID() : "-1"));

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

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

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

sizeBytes = bitstream.getSizeBytes();
String path = new DSpace().getRequestService().getCurrentRequest().getHttpServletRequest().getContextPath();
retrieveLink = path + "/bitstreams/" + bitstream.getID() + "/retrieve";

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

arLink.setAttribute("title", bs.getName());
arLink.setAttribute("type", bs.getFormat(context).getMIMEType());
arLink.setAttribute("length", Long.toString(bs.getSizeBytes()));

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

file.setID(fileID);
file.setMIMETYPE(logoBs.getFormat(context).getMIMEType());
file.setSIZE(logoBs.getSizeBytes());

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

SyndEnclosure enc = new SyndEnclosureImpl();
enc.setType(bit.getFormat(context).getMIMEType());
enc.setLength(bit.getSizeBytes());
enc.setUrl(urlOfBitstream(request, bit));
enclosures.add(enc);

代码示例来源: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: 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

.getMIMEType()));
bitstream.getField().add(
  createValue("size", "" + bit.getSizeBytes()));
bitstream.getField().add(createValue("url", url));
bitstream.getField().add(

相关文章