本文整理了Java中java.io.RandomAccessFile.skipBytes
方法的一些代码示例,展示了RandomAccessFile.skipBytes
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomAccessFile.skipBytes
方法的具体详情如下:
包路径:java.io.RandomAccessFile
类名称:RandomAccessFile
方法名:skipBytes
[英]Skips over count bytes in this file. Less than countbytes are skipped if the end of the file is reached or an exception is thrown during the operation. Nothing is done if count is negative.
[中]跳过此文件中的字节计数。如果在操作过程中到达文件结尾或引发异常,则跳过少于countbytes。如果计数为负数,则不会执行任何操作。
代码示例来源:origin: nutzam/nutz
@Override
public long skip(long n) throws IOException {
return raf.skipBytes((int) n);
}
代码示例来源:origin: alibaba/mdrill
/**
* Skips the given number of bytes or throws an EOFException if
* skipping failed.
*/
private void skipBytes(final int count) throws IOException {
int totalSkipped = 0;
while (totalSkipped < count) {
int skippedNow = archive.skipBytes(count - totalSkipped);
if (skippedNow <= 0) {
throw new EOFException();
}
totalSkipped += skippedNow;
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* Skips the given number of bytes or throws an EOFException if
* skipping failed.
*/
private void skipBytes(final int count) throws IOException {
int totalSkipped = 0;
while (totalSkipped < count) {
final int skippedNow = archive.skipBytes(count - totalSkipped);
if (skippedNow <= 0) {
throw new EOFException();
}
totalSkipped += skippedNow;
}
}
代码示例来源:origin: apache/flume
protected static void skipRecord(RandomAccessFile fileHandle,
int offset) throws IOException {
fileHandle.seek(offset);
int length = fileHandle.readInt();
fileHandle.skipBytes(length);
}
代码示例来源:origin: apache/activemq
@Override
public int skipBytes(int i) throws IOException {
try {
return getRaf().skipBytes(i);
} catch (IOException ioe) {
handleException();
throw ioe;
}
}
代码示例来源:origin: org.apache.ant/ant
int lenToSkip = fileNameLen;
while (lenToSkip > 0) {
final int skipped = archive.skipBytes(lenToSkip);
if (skipped <= 0) {
throw new IOException(
代码示例来源:origin: alibaba/mdrill
int lenToSkip = fileNameLen;
while (lenToSkip > 0) {
int skipped = archive.skipBytes(lenToSkip);
if (skipped <= 0) {
throw new IOException("failed to skip file name in"
代码示例来源:origin: osmandapp/Osmand
bufferPos = 0;
bufferSize = 0;
int n = raf.skipBytes(size - pos);
totalBytesRetired = (int) raf.getFilePointer();
if (n <= 0) {
代码示例来源:origin: haraldk/TwelveMonkeys
public int skipBytes(final int n) throws IOException {
return file.skipBytes(n);
}
代码示例来源:origin: i2p/i2p.i2p
public int skipBytes(int n) throws IOException { return delegate.skipBytes(n); }
代码示例来源:origin: i2p/i2p.i2p
void skipBytes(final int n) throws IOException {
int bytesSkipped = ras.skipBytes(n);
if(this.debug) {
System.out.println("Skipping "+bytesSkipped+" bytes");
}
}
代码示例来源:origin: ahmetaa/zemberek-nlp
private ChunkIterator() {
data = new byte[chunkByteSize];
try {
raf = new RandomAccessFile(file, "r");
raf.skipBytes(8);
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: i2p/i2p.i2p
int align(int boundary) throws IOException {
int skip = (int) (boundary - (ras.getFilePointer() % boundary)) % boundary;
if (skip != 0) {
skip = ras.skipBytes(skip);
}
if(this.debug) {
System.out.println("Aligning to boundary "+ boundary +". Offset is now "+ras.getFilePointer());
}
return skip;
}
代码示例来源:origin: typ0520/fastdex
raf.skipBytes(2); // diskNumber
raf.skipBytes(2); // diskWithCentralDir
raf.skipBytes(2); // numEntries
raf.skipBytes(2); // totalNumEntries
CentralDirectory dir = new CentralDirectory();
dir.size = Integer.reverseBytes(raf.readInt()) & 0xFFFFFFFFL;
代码示例来源:origin: ahmetaa/zemberek-nlp
raf.skipBytes(8);
int actual;
while ((actual = raf.read(buffer)) > 0) {
代码示例来源:origin: dcm4che/dcm4che-core
@Override
public long skip(long n) throws IOException {
return raf.skipBytes((int) n);
}
}
代码示例来源:origin: com.github.axet/jebml
@Override
public long skip(final long offset)
{
try
{
return file.skipBytes((int) offset);
}
catch (final IOException ex)
{
return 0;
}
}
代码示例来源:origin: org.restcomm.media.core.resource/player
@Override
public int load(RandomAccessFile raAccFile) throws IOException {
// 1 is for Type
int count = 15;
while (count != 0) {
// TODO : do you want to keep paded data?
count -= raAccFile.skipBytes(count);
}
return 16;
}
}
代码示例来源:origin: org.apache.flume.flume-ng-channels/flume-file-channel
protected static void skipRecord(RandomAccessFile fileHandle,
int offset) throws IOException {
fileHandle.seek(offset);
int length = fileHandle.readInt();
fileHandle.skipBytes(length);
}
代码示例来源:origin: com.github.sbtourist/journalio
public static void skipBytes(RandomAccessFile raf, int bytes) throws IOException {
int n = 0;
while (n < bytes) {
int skipped = raf.skipBytes(bytes - n);
if (skipped == 0 && raf.getFilePointer() >= raf.length()) {
throw new EOFException();
}
n += skipped;
}
}
内容来源于网络,如有侵权,请联系作者删除!