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


Java ImageInputStream.readFully方法代码示例

本文整理汇总了Java中javax.imageio.stream.ImageInputStream.readFully方法的典型用法代码示例。如果您正苦于以下问题:Java ImageInputStream.readFully方法的具体用法?Java ImageInputStream.readFully怎么用?Java ImageInputStream.readFully使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.imageio.stream.ImageInputStream的用法示例。


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

示例1: canDecodeInput

import javax.imageio.stream.ImageInputStream; //导入方法依赖的package包/类
public boolean canDecodeInput(Object input) throws IOException {
    if (!(input instanceof ImageInputStream)) {
        return false;
    }

    ImageInputStream stream = (ImageInputStream)input;
    byte[] b = new byte[8];
    stream.mark();
    stream.readFully(b);
    stream.reset();

    return (b[0] == (byte)137 &&
            b[1] == (byte)80 &&
            b[2] == (byte)78 &&
            b[3] == (byte)71 &&
            b[4] == (byte)13 &&
            b[5] == (byte)10 &&
            b[6] == (byte)26 &&
            b[7] == (byte)10);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:PNGImageReaderSpi.java

示例2: canDecodeInput

import javax.imageio.stream.ImageInputStream; //导入方法依赖的package包/类
public boolean canDecodeInput(Object input) throws IOException {
    if (!(input instanceof ImageInputStream)) {
        return false;
    }

    ImageInputStream stream = (ImageInputStream)input;
    byte[] b = new byte[4];
    stream.mark();
    stream.readFully(b);
    stream.reset();

    return ((b[0] == (byte)0x49 && b[1] == (byte)0x49 &&
             b[2] == (byte)0x2a && b[3] == (byte)0x00) ||
            (b[0] == (byte)0x4d && b[1] == (byte)0x4d &&
             b[2] == (byte)0x00 && b[3] == (byte)0x2a));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TIFFImageReaderSpi.java

示例3: canDecodeInput

import javax.imageio.stream.ImageInputStream; //导入方法依赖的package包/类
@Override
public boolean canDecodeInput(Object input) throws IOException {
  loadLibrary();
  if (!(input instanceof ImageInputStream)) {
    input = ImageIO.createImageInputStream(input);
  }
  if (input == null) {
    return false;
  }
  ImageInputStream stream = (ImageInputStream)input;
  byte[] b = new byte[2];
  try {
    stream.mark();
    stream.readFully(b);
  } catch (IOException e) {
    return false;
  }
  return Arrays.equals(b, HEADER_MAGIC);
}
 
开发者ID:dbmdz,项目名称:imageio-jnr,代码行数:20,代码来源:TurboJpegImageReaderSpi.java

示例4: canDecodeInput

import javax.imageio.stream.ImageInputStream; //导入方法依赖的package包/类
@Override
public boolean canDecodeInput(Object input) throws IOException {
  if (!(input instanceof ImageInputStream)) {
    input = ImageIO.createImageInputStream(input);
  }
  if (input == null) {
    return false;
  }
  ImageInputStream stream = (ImageInputStream)input;
  byte[] b = new byte[12];
  try {
    stream.mark();
    stream.readFully(b);
  } catch (IOException e) {
    return false;
  }
  return Arrays.equals(b, HEADER_MAGIC);
}
 
开发者ID:dbmdz,项目名称:imageio-jnr,代码行数:19,代码来源:OpenJp2ImageReaderSpi.java

示例5: canDecodeInput

import javax.imageio.stream.ImageInputStream; //导入方法依赖的package包/类
public boolean canDecodeInput(Object input) throws IOException {
    if (!(input instanceof ImageInputStream)) {
        return false;
    }

    ImageInputStream stream = (ImageInputStream)input;
    byte[] b = new byte[6];
    stream.mark();
    stream.readFully(b);
    stream.reset();

    return b[0] == 'G' && b[1] == 'I' && b[2] == 'F' && b[3] == '8' &&
        (b[4] == '7' || b[4] == '9') && b[5] == 'a';
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:GIFImageReaderSpi.java

示例6: canDecodeInput

import javax.imageio.stream.ImageInputStream; //导入方法依赖的package包/类
public boolean canDecodeInput(Object source) throws IOException {
    if (!(source instanceof ImageInputStream)) {
        return false;
    }

    ImageInputStream stream = (ImageInputStream)source;
    byte[] b = new byte[2];
    stream.mark();
    stream.readFully(b);
    stream.reset();

    return (b[0] == 0x42) && (b[1] == 0x4d);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:BMPImageReaderSpi.java


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