本文整理了Java中java.io.RandomAccessFile.readShort
方法的一些代码示例,展示了RandomAccessFile.readShort
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomAccessFile.readShort
方法的具体详情如下:
包路径:java.io.RandomAccessFile
类名称:RandomAccessFile
方法名:readShort
[英]Reads a big-endian 16-bit short from the current position in this file. Blocks until two bytes have been read, the end of the file is reached or an exception is thrown.
[中]
代码示例来源:origin: robovm/robovm
/**
* Reads a big-endian 16-bit character from the current position in this file. Blocks until
* two bytes have been read, the end of the file is reached or an exception is
* thrown.
*
* @return the next char value from this file.
* @throws EOFException
* if the end of this file is detected.
* @throws IOException
* if this file is closed or another I/O error occurs.
* @see #writeChar(int)
*/
public final char readChar() throws IOException {
return (char) readShort();
}
代码示例来源:origin: robovm/robovm
/**
* Reads an unsigned big-endian 16-bit short from the current position in this file and
* returns it as an integer. Blocks until two bytes have been read, the end of
* the file is reached or an exception is thrown.
*
* @return the next unsigned short value from this file as an int.
* @throws EOFException
* if the end of this file is detected.
* @throws IOException
* if this file is closed or another I/O error occurs.
* @see #writeShort(int)
*/
public final int readUnsignedShort() throws IOException {
return ((int) readShort()) & 0xffff;
}
代码示例来源:origin: atomix/atomix
@Override
public short readShort(int offset) {
checkRead(offset, SHORT);
try {
seekToOffset(offset);
return randomAccessFile.readShort();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/activemq
@Override
public short readShort() throws IOException {
try {
return getRaf().readShort();
} catch (IOException ioe) {
handleException();
throw ioe;
}
}
代码示例来源:origin: apache/pdfbox
/**
* Read a signed short.
*
* @return An signed short.
* @throws IOException If there is an error reading the data.
* @see RandomAccessFile#readShort()
*/
@Override
public short readSignedShort() throws IOException
{
return raf.readShort();
}
代码示例来源:origin: i2p/i2p.i2p
public short readShort() throws IOException { return delegate.readShort(); }
public int readUnsignedByte() throws IOException { return delegate.readUnsignedByte(); }
代码示例来源:origin: geotools/geotools
return raf.readByte();
} else if (binding == Short.class || binding == short.class) {
return raf.readShort();
} else if (binding == Integer.class || binding == int.class) {
return raf.readInt();
代码示例来源:origin: com.github.lafa.pdfbox/fontbox
/**
* Read a signed short.
*
* @return An signed short.
* @throws IOException If there is an error reading the data.
* @see RandomAccessFile#readShort()
*/
@Override
public short readSignedShort() throws IOException
{
return raf.readShort();
}
代码示例来源:origin: org.jetbrains.intellij.deps/commons-vfs2
@Override
public short readShort() throws IOException
{
return raf.readShort();
}
代码示例来源:origin: TomRoush/PdfBox-Android
/**
* Read an signed short.
*
* @return An signed short.
* @throws IOException If there is an error reading the data.
*/
public short readSignedShort() throws IOException
{
return raf.readShort();
}
代码示例来源:origin: apache/batik
protected NameRecord(RandomAccessFile raf) throws IOException {
platformId = raf.readShort();
encodingId = raf.readShort();
languageId = raf.readShort();
nameId = raf.readShort();
stringLength = raf.readShort();
stringOffset = raf.readShort();
}
代码示例来源:origin: AlexMofer/ProjectX
@Override
public float readFixed() throws IOException {
final int integer = mFile.readShort();
final int decimal = mFile.readShort();
try {
return integer + Integer.parseInt(Integer.toHexString(decimal)) * 0.0001f;
} catch (Exception e) {
return integer;
}
}
代码示例来源:origin: mattjlewis/diozero
@Override
public short processCall(int register, short data) {
writeWordData(register, data);
try {
return deviceFile.readShort();
} catch (IOException e) {
throw new RuntimeIOException("Error in I2C processCall for device i2c-" + controller + "-0x"
+ Integer.toHexString(deviceAddress), e);
}
}
代码示例来源:origin: atomix/catalyst
@Override
public short readShort(long offset) {
checkRead(offset, SHORT);
try {
seekToOffset(offset);
return randomAccessFile.readShort();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: tonihele/OpenKeeper
protected genAmountType(RandomAccessFile file) throws IOException {
ranges = new rangesType(file);
shAmount = file.readShort();
wAmount = ConversionUtils.readUnsignedShort(file);
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
@Override
public short readShort() throws IOException {
try {
return getRaf().readShort();
} catch (IOException ioe) {
handleException();
throw ioe;
}
}
代码示例来源:origin: org.apache.activemq/activemq-kahadb-store
@Override
public short readShort() throws IOException {
try {
return getRaf().readShort();
} catch (IOException ioe) {
handleException();
throw ioe;
}
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
@Override
public short readShort() throws IOException {
try {
return getRaf().readShort();
} catch (IOException ioe) {
handleException();
throw ioe;
}
}
代码示例来源:origin: tonihele/OpenKeeper
protected sfModList(RandomAccessFile file) throws IOException {
sfModSrcOper = new SFModulator(file);
sfModDestOper = new SFGenerator(file);
modAmount = file.readShort();
sfModAmtSrcOper = new SFModulator(file);
sfModTransOper = new SFTransform(file);
}
代码示例来源:origin: octo-online/reactive-audit
@Test(expected = FileReactiveAuditException.class)
public void readShort()
throws IOException
{
ReactiveAudit.off.commit();
try (RandomAccessFile rw = newRandomAccessFile())
{
TestTools.strict.commit();
rw.readShort();
}
}
内容来源于网络,如有侵权,请联系作者删除!