org.apache.wicket.util.io.IOUtils.toByteArray()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(138)

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

IOUtils.toByteArray介绍

[英]Get the contents of an InputStream as a byte[].

This method buffers the input internally, so there is no need to use a BufferedInputStream.
[中]将InputStream的内容作为byte[]获取。
此方法在内部缓冲输入,因此无需使用BufferedInputStream

代码示例

代码示例来源:origin: org.wicketstuff/yui

@Override
  protected byte[] getImageData() {
    try {
      return IOUtils.toByteArray(new FileInputStream(file));
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
});

代码示例来源:origin: org.apache.wicket/wicket-util

/**
 * read binary file fully
 * 
 * @param file
 *            file to read
 * @return byte array representing the content of the file
 * @throws IOException
 *             is something went wrong
 */
public static byte[] readBytes(final File file) throws IOException
{
  FileInputStream stream = new FileInputStream(file);
  try
  {
    return IOUtils.toByteArray(stream);
  }
  finally
  {
    stream.close();
  }
}

代码示例来源:origin: org.apache.wicket/wicket-core

@Override
public byte[] get()
{
  try
  {
    return IOUtils.toByteArray(getInputStream());
  }
  catch (IOException iox)
  {
    throw new WicketRuntimeException("Could not read upload's part input stream", iox);
  }
}

代码示例来源:origin: apache/wicket

@Override
public byte[] get()
{
  try
  {
    return IOUtils.toByteArray(getInputStream());
  }
  catch (IOException iox)
  {
    throw new WicketRuntimeException("Could not read upload's part input stream", iox);
  }
}

代码示例来源:origin: org.apache.wicket/wicket-core

byte[] bytes = IOUtils.toByteArray(stream);

代码示例来源:origin: apache/wicket

byte[] bytes = IOUtils.toByteArray(stream);

代码示例来源:origin: org.apache.wicket/wicket-core

try
  byte[] bytes = IOUtils.toByteArray(inputStream);
  String base64EncodedImage = Base64.getEncoder().encodeToString(bytes);
  return "data:" + resourceStream.getContentType() + ";base64," +

代码示例来源:origin: apache/wicket

try
  byte[] bytes = IOUtils.toByteArray(inputStream);
  String base64EncodedImage = Base64.getEncoder().encodeToString(bytes);
  return "data:" + resourceStream.getContentType() + ";base64," +

代码示例来源:origin: org.apache.wicket/wicket-core

bytes = IOUtils.toByteArray(inputStream);

代码示例来源:origin: apache/wicket

bytes = IOUtils.toByteArray(inputStream);
resourceResponse.setContentLength(bytes.length);

代码示例来源:origin: apache/wicket

bytes = IOUtils.toByteArray(inputStream);

代码示例来源:origin: org.apache.wicket/wicket-core

bytes = IOUtils.toByteArray(inputStream);
resourceResponse.setContentLength(bytes.length);

相关文章