java.util.jar.Manifest.exposeByteArrayInputStreamBytes()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(101)

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

Manifest.exposeByteArrayInputStreamBytes介绍

[英]Returns a byte[] containing all the bytes from a ByteArrayInputStream. Where possible, this returns the actual array rather than a copy.
[中]返回包含ByteArrayInputStream中所有字节的字节[]。如果可能,这将返回实际数组而不是副本。

代码示例

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

/**
 * Merges name/attribute pairs read from the input stream {@code is} into this manifest.
 *
 * @param is
 *            The {@code InputStream} to read from.
 * @throws IOException
 *             If an error occurs reading the manifest.
 */
public void read(InputStream is) throws IOException {
  byte[] buf;
  if (is instanceof ByteArrayInputStream) {
    buf = exposeByteArrayInputStreamBytes((ByteArrayInputStream) is);
  } else {
    buf = Streams.readFullyNoClose(is);
  }
  if (buf.length == 0) {
    return;
  }
  // a workaround for HARMONY-5662
  // replace EOF and NUL with another new line
  // which does not trigger an error
  byte b = buf[buf.length - 1];
  if (b == 0 || b == 26) {
    buf[buf.length - 1] = '\n';
  }
  ManifestReader im = new ManifestReader(buf, mainAttributes);
  mainEnd = im.getEndOfMainSection();
  im.readEntries(entries, chunks);
}

代码示例来源:origin: ibinti/bugvm

/**
 * Merges name/attribute pairs read from the input stream {@code is} into this manifest.
 *
 * @param is
 *            The {@code InputStream} to read from.
 * @throws IOException
 *             If an error occurs reading the manifest.
 */
public void read(InputStream is) throws IOException {
  byte[] buf;
  if (is instanceof ByteArrayInputStream) {
    buf = exposeByteArrayInputStreamBytes((ByteArrayInputStream) is);
  } else {
    buf = Streams.readFullyNoClose(is);
  }
  if (buf.length == 0) {
    return;
  }
  // a workaround for HARMONY-5662
  // replace EOF and NUL with another new line
  // which does not trigger an error
  byte b = buf[buf.length - 1];
  if (b == 0 || b == 26) {
    buf[buf.length - 1] = '\n';
  }
  ManifestReader im = new ManifestReader(buf, mainAttributes);
  mainEnd = im.getEndOfMainSection();
  im.readEntries(entries, chunks);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Merges name/attribute pairs read from the input stream {@code is} into this manifest.
 *
 * @param is
 *            The {@code InputStream} to read from.
 * @throws IOException
 *             If an error occurs reading the manifest.
 */
public void read(InputStream is) throws IOException {
  byte[] buf;
  if (is instanceof ByteArrayInputStream) {
    buf = exposeByteArrayInputStreamBytes((ByteArrayInputStream) is);
  } else {
    buf = Streams.readFullyNoClose(is);
  }
  if (buf.length == 0) {
    return;
  }
  // a workaround for HARMONY-5662
  // replace EOF and NUL with another new line
  // which does not trigger an error
  byte b = buf[buf.length - 1];
  if (b == 0 || b == 26) {
    buf[buf.length - 1] = '\n';
  }
  ManifestReader im = new ManifestReader(buf, mainAttributes);
  mainEnd = im.getEndOfMainSection();
  im.readEntries(entries, chunks);
}

代码示例来源:origin: MobiVM/robovm

/**
 * Merges name/attribute pairs read from the input stream {@code is} into this manifest.
 *
 * @param is
 *            The {@code InputStream} to read from.
 * @throws IOException
 *             If an error occurs reading the manifest.
 */
public void read(InputStream is) throws IOException {
  byte[] buf;
  if (is instanceof ByteArrayInputStream) {
    buf = exposeByteArrayInputStreamBytes((ByteArrayInputStream) is);
  } else {
    buf = Streams.readFullyNoClose(is);
  }
  if (buf.length == 0) {
    return;
  }
  // a workaround for HARMONY-5662
  // replace EOF and NUL with another new line
  // which does not trigger an error
  byte b = buf[buf.length - 1];
  if (b == 0 || b == 26) {
    buf[buf.length - 1] = '\n';
  }
  ManifestReader im = new ManifestReader(buf, mainAttributes);
  mainEnd = im.getEndOfMainSection();
  im.readEntries(entries, chunks);
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Merges name/attribute pairs read from the input stream {@code is} into this manifest.
 *
 * @param is
 *            The {@code InputStream} to read from.
 * @throws IOException
 *             If an error occurs reading the manifest.
 */
public void read(InputStream is) throws IOException {
  byte[] buf;
  if (is instanceof ByteArrayInputStream) {
    buf = exposeByteArrayInputStreamBytes((ByteArrayInputStream) is);
  } else {
    buf = Streams.readFullyNoClose(is);
  }
  if (buf.length == 0) {
    return;
  }
  // a workaround for HARMONY-5662
  // replace EOF and NUL with another new line
  // which does not trigger an error
  byte b = buf[buf.length - 1];
  if (b == 0 || b == 26) {
    buf[buf.length - 1] = '\n';
  }
  ManifestReader im = new ManifestReader(buf, mainAttributes);
  mainEnd = im.getEndOfMainSection();
  im.readEntries(entries, chunks);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Merges name/attribute pairs read from the input stream {@code is} into this manifest.
 *
 * @param is
 *            The {@code InputStream} to read from.
 * @throws IOException
 *             If an error occurs reading the manifest.
 */
public void read(InputStream is) throws IOException {
  byte[] buf;
  if (is instanceof ByteArrayInputStream) {
    buf = exposeByteArrayInputStreamBytes((ByteArrayInputStream) is);
  } else {
    buf = Streams.readFullyNoClose(is);
  }
  if (buf.length == 0) {
    return;
  }
  // a workaround for HARMONY-5662
  // replace EOF and NUL with another new line
  // which does not trigger an error
  byte b = buf[buf.length - 1];
  if (b == 0 || b == 26) {
    buf[buf.length - 1] = '\n';
  }
  ManifestReader im = new ManifestReader(buf, mainAttributes);
  mainEnd = im.getEndOfMainSection();
  im.readEntries(entries, chunks);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Merges name/attribute pairs read from the input stream {@code is} into this manifest.
 *
 * @param is
 *            The {@code InputStream} to read from.
 * @throws IOException
 *             If an error occurs reading the manifest.
 */
public void read(InputStream is) throws IOException {
  byte[] buf;
  if (is instanceof ByteArrayInputStream) {
    buf = exposeByteArrayInputStreamBytes((ByteArrayInputStream) is);
  } else {
    buf = Streams.readFullyNoClose(is);
  }
  if (buf.length == 0) {
    return;
  }
  // a workaround for HARMONY-5662
  // replace EOF and NUL with another new line
  // which does not trigger an error
  byte b = buf[buf.length - 1];
  if (b == 0 || b == 26) {
    buf[buf.length - 1] = '\n';
  }
  ManifestReader im = new ManifestReader(buf, mainAttributes);
  mainEnd = im.getEndOfMainSection();
  im.readEntries(entries, chunks);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Merges name/attribute pairs read from the input stream {@code is} into this manifest.
 *
 * @param is
 *            The {@code InputStream} to read from.
 * @throws IOException
 *             If an error occurs reading the manifest.
 */
public void read(InputStream is) throws IOException {
  byte[] buf;
  if (is instanceof ByteArrayInputStream) {
    buf = exposeByteArrayInputStreamBytes((ByteArrayInputStream) is);
  } else {
    buf = Streams.readFullyNoClose(is);
  }
  if (buf.length == 0) {
    return;
  }
  // a workaround for HARMONY-5662
  // replace EOF and NUL with another new line
  // which does not trigger an error
  byte b = buf[buf.length - 1];
  if (b == 0 || b == 26) {
    buf[buf.length - 1] = '\n';
  }
  ManifestReader im = new ManifestReader(buf, mainAttributes);
  mainEnd = im.getEndOfMainSection();
  im.readEntries(entries, chunks);
}

相关文章