java.io.RandomAccessFile.readUnsignedByte()方法的使用及代码示例

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

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

RandomAccessFile.readUnsignedByte介绍

[英]Reads an unsigned 8-bit byte from the current position in this file and returns it as an integer. Blocks until one byte has been read, the end of the file is reached or an exception is thrown.
[中]从文件中的当前位置读取一个无符号8位字节,并将其作为整数返回。块,直到读取一个字节、到达文件结尾或引发异常为止。

代码示例

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

@Override
public int readUnsignedByte() throws IOException {
  try {
    return getRaf().readUnsignedByte();
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

代码示例来源:origin: ivan-vasilev/neuralnetworks

if (labelSize > 1)
  f.readUnsignedByte();
target = f.readUnsignedByte();

代码示例来源:origin: ivan-vasilev/neuralnetworks

target.getElements()[target.getStartIndex() + i * 10 + labels.readUnsignedByte()] = 1;

代码示例来源:origin: i2p/i2p.i2p

public int readUnsignedByte()		throws IOException { return delegate.readUnsignedByte(); }
public int readUnsignedShort()		throws IOException { return delegate.readUnsignedShort(); }

代码示例来源:origin: com.github.stephenc.java-iso-tools/sabre

public static long readUInt64AsLong(RandomAccessFile myRandomAccessFile)
    throws IOException {
  long result = myRandomAccessFile.readUnsignedByte()
      | (myRandomAccessFile.readUnsignedByte() << 8)
      | (myRandomAccessFile.readUnsignedByte() << 16)
      | (myRandomAccessFile.readUnsignedByte() << 24)
      | (myRandomAccessFile.readUnsignedByte() << 32)
      | (myRandomAccessFile.readUnsignedByte() << 40)
      | (myRandomAccessFile.readUnsignedByte() << 48)
      | (myRandomAccessFile.readUnsignedByte() << 56);
  return result;
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

protected void readInstructions(RandomAccessFile raf, int count) throws IOException {
  instructions = new short[count];
  for (int i = 0; i < count; i++) {
    instructions[i] = (short) raf.readUnsignedByte();
  }
}

代码示例来源:origin: com.github.stephenc.java-iso-tools/sabre

public static long readUInt32AsLong(RandomAccessFile myRandomAccessFile)
    throws IOException {
  long result = myRandomAccessFile.readUnsignedByte()
      | (myRandomAccessFile.readUnsignedByte() << 8)
      | (myRandomAccessFile.readUnsignedByte() << 16)
      | (myRandomAccessFile.readUnsignedByte() << 24);
  return result;
}

代码示例来源:origin: com.github.stephenc.java-iso-tools/sabre

public static int readUInt32AsInt(RandomAccessFile myRandomAccessFile)
    throws IOException {
  int result = myRandomAccessFile.readUnsignedByte()
      | (myRandomAccessFile.readUnsignedByte() << 8)
      | (myRandomAccessFile.readUnsignedByte() << 16)
      | (myRandomAccessFile.readUnsignedByte() << 24);
  return result;
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

protected CmapFormat0(RandomAccessFile raf) throws IOException {
  super(raf);
  format = 0;
  first = -1;
  for (int i = 0; i < 256; i++) {
    glyphIdArray[i] = raf.readUnsignedByte();
    if (glyphIdArray[i] > 0) {
      if (first == -1) first = i;
      last = i;
    }
  }
}

代码示例来源:origin: com.github.stephenc.java-iso-tools/sabre

public void read(RandomAccessFile myRandomAccessFile)
    throws IOException {
  lb_num = myRandomAccessFile.readUnsignedByte() + myRandomAccessFile.readUnsignedByte() * 256 +
      myRandomAccessFile.readUnsignedByte() * 256 * 256 +
      (int) myRandomAccessFile.readUnsignedByte() * 256 * 256 * 256;
  part_num = myRandomAccessFile.readUnsignedByte() + myRandomAccessFile.readUnsignedByte() * 256;
}

代码示例来源:origin: de.sciss/jump3r

private int Read16BitsHighLow(final RandomAccessFile fp) {
  try {
    int high = fp.readUnsignedByte();
    int low = fp.readUnsignedByte();
    return (high << 8) | low;
  } catch (IOException e) {
    e.printStackTrace();
    return 0;
  }
}

代码示例来源:origin: org.mapdb/mapdb

@Override
public synchronized int getUnsignedShort(long offset) {
  try {
    raf.seek(offset);
    return (raf.readUnsignedByte() << 8) |
        raf.readUnsignedByte();
  } catch (IOException e) {
    throw new DBException.VolumeIOError(e);
  }
}

代码示例来源:origin: org.onosproject/onlab-thirdparty

@Override
public int readUnsignedByte(long offset) {
 checkRead(offset, BYTE);
 try {
  seekToOffset(offset);
  return randomAccessFile.readUnsignedByte();
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: mattjlewis/diozero

@Override
public byte readByteData(int register) {
  try {
    deviceFile.writeByte(register);
    return (byte) deviceFile.readUnsignedByte();
  } catch (IOException e) {
    throw new RuntimeIOException("Error in I2C readByteData for device i2c-" + controller + "-0x"
        + Integer.toHexString(deviceAddress), e);
  }
}

代码示例来源:origin: io.atomix/catalyst-buffer

@Override
public int readUnsignedByte(long offset) {
 checkRead(offset, BYTE);
 try {
  seekToOffset(offset);
  return randomAccessFile.readUnsignedByte();
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: org.apache.activemq/activemq-kahadb-store

@Override
public int readUnsignedByte() throws IOException {
  try {
    return getRaf().readUnsignedByte();
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

代码示例来源:origin: org.apache.activemq/activemq-all

@Override
public int readUnsignedByte() throws IOException {
  try {
    return getRaf().readUnsignedByte();
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

@Override
public int readUnsignedByte() throws IOException {
  try {
    return getRaf().readUnsignedByte();
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

代码示例来源:origin: com.github.stephenc.java-iso-tools/sabre

public void read(RandomAccessFile myRandomAccessFile)
    throws IOException {
  TagIdentifier = BinaryTools.readUInt16AsInt(myRandomAccessFile);
  DescriptorVersion = BinaryTools.readUInt16AsInt(myRandomAccessFile);
  TagChecksum = (short) myRandomAccessFile.readUnsignedByte();
  Reserved = myRandomAccessFile.readByte();
  TagSerialNumber = BinaryTools.readUInt16AsInt(myRandomAccessFile);
  DescriptorCRC = BinaryTools.readUInt16AsInt(myRandomAccessFile);
  DescriptorCRCLength = BinaryTools.readUInt16AsInt(myRandomAccessFile);
  TagLocation = BinaryTools.readUInt32AsLong(myRandomAccessFile);
}

代码示例来源:origin: octo-online/reactive-audit

@Test(expected = FileReactiveAuditException.class)
public void readUnsignedByte()
    throws IOException
{
  ReactiveAudit.off.commit();
  try (RandomAccessFile rw = newRandomAccessFile())
  {
    TestTools.strict.commit();
    rw.readUnsignedByte();
  }
}

相关文章