java.io.EOFException.initCause()方法的使用及代码示例

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

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

EOFException.initCause介绍

暂无

代码示例

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

private void rethrowEofException(IOException ioEx) throws IOException {
 boolean isEof = false;
 try {
  isEof = this.in.available() == 0;
 } catch (Throwable t) {
  LOG.trace("Error getting available for error message - ignoring", t);
 }
 if (!isEof) throw ioEx;
 if (LOG.isTraceEnabled()) {
  LOG.trace("Partial cell read caused by EOF", ioEx);
 }
 EOFException eofEx = new EOFException("Partial cell read");
 eofEx.initCause(ioEx);
 throw eofEx;
}

代码示例来源:origin: com.h2database/h2

@Override
public synchronized int read(ByteBuffer dst) throws IOException {
  try {
    int len = dst.remaining();
    if (len == 0) {
      return 0;
    }
    len = (int) Math.min(len, fileLength - pos);
    if (len <= 0) {
      return -1;
    }
    mapped.position(pos);
    mapped.get(dst.array(), dst.arrayOffset() + dst.position(), len);
    dst.position(dst.position() + len);
    pos += len;
    return len;
  } catch (IllegalArgumentException e) {
    EOFException e2 = new EOFException("EOF");
    e2.initCause(e);
    throw e2;
  } catch (BufferUnderflowException e) {
    EOFException e2 = new EOFException("EOF");
    e2.initCause(e);
    throw e2;
  }
}

代码示例来源:origin: lealone/Lealone

@Override
public synchronized int read(ByteBuffer dst) throws IOException {
  try {
    int len = dst.remaining();
    if (len == 0) {
      return 0;
    }
    len = (int) Math.min(len, fileLength - pos);
    if (len <= 0) {
      return -1;
    }
    mapped.position(pos);
    mapped.get(dst.array(), dst.arrayOffset() + dst.position(), len);
    dst.position(dst.position() + len);
    pos += len;
    return len;
  } catch (IllegalArgumentException e) {
    EOFException e2 = new EOFException("EOF");
    e2.initCause(e);
    throw e2;
  } catch (BufferUnderflowException e) {
    EOFException e2 = new EOFException("EOF");
    e2.initCause(e);
    throw e2;
  }
}

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

EOFException eof = new EOFException("Locator at " + ipAddr
  + " did not respond. This is normal if the locator was shutdown. If it wasn't check its log for exceptions.");
eof.initCause(ex);
throw eof;

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

throw (EOFException) new EOFException("Invalid PB, EOF? Ignoring; originalPosition=" +
 originalPosition + ", currentPosition=" + this.inputStream.getPos() +
 ", messageSize=" + size + ", currentAvailable=" + available).initCause(ipbe);
IOException realEofEx = extractHiddenEof(ex);
throw (EOFException) new EOFException("EOF " + message).
  initCause(realEofEx != null ? realEofEx : ex);

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

private void rethrowEofException(IOException ioEx) throws IOException {
 boolean isEof = false;
 try {
  isEof = this.in.available() == 0;
 } catch (Throwable t) {
  LOG.trace("Error getting available for error message - ignoring", t);
 }
 if (!isEof) throw ioEx;
 if (LOG.isTraceEnabled()) {
  LOG.trace("Partial cell read caused by EOF", ioEx);
 }
 EOFException eofEx = new EOFException("Partial cell read");
 eofEx.initCause(ioEx);
 throw eofEx;
}

代码示例来源:origin: freenet/fred

@Override
public void readFully(byte[] b) throws IOException {
  try {
    buf.get(b);
  } catch (BufferUnderflowException e) {
    throw (EOFException)new EOFException().initCause(e);
  }
}

代码示例来源:origin: freenet/fred

@Override
public long readLong() throws IOException {
  try {
    return buf.getLong();
  } catch (BufferUnderflowException e) {
    throw (EOFException)new EOFException().initCause(e);
  }
}

代码示例来源:origin: freenet/fred

@Override
public byte readByte() throws IOException {
  try {
    return buf.get();
  } catch (BufferUnderflowException e) {
    throw (EOFException)new EOFException().initCause(e);
  }
}

代码示例来源:origin: freenet/fred

@Override
public double readDouble() throws IOException {
  try {
    return buf.getDouble();
  } catch (BufferUnderflowException e) {
    throw (EOFException)new EOFException().initCause(e);
  }
}

代码示例来源:origin: freenet/fred

@Override
public int readUnsignedShort() throws IOException {
  try {
    return buf.getShort() & 0xFFFF;
  } catch (BufferUnderflowException e) {
    throw (EOFException)new EOFException().initCause(e);
  }
}

代码示例来源:origin: freenet/fred

@Override
public float readFloat() throws IOException {
  try {
    return buf.getFloat();
  } catch (BufferUnderflowException e) {
    throw (EOFException)new EOFException().initCause(e);
  }
}

代码示例来源:origin: freenet/fred

@Override
public void readFully(byte[] b, int off, int len) throws IOException {
  try {
    buf.get(b, off, len);
  } catch (BufferUnderflowException e) {
    throw (EOFException)new EOFException().initCause(e);
  }
}

代码示例来源:origin: freenet/fred

@Override
public int readUnsignedByte() throws IOException {
  try {
    return buf.get() & 0xFF;
  } catch (BufferUnderflowException e) {
    throw (EOFException)new EOFException().initCause(e);
  }
}

代码示例来源:origin: freenet/fred

@Override
public int readInt() throws IOException {
  try {
    return buf.getInt();
  } catch (BufferUnderflowException e) {
    throw (EOFException)new EOFException().initCause(e);
  }
}

代码示例来源:origin: freenet/fred

@Override
public short readShort() throws IOException {
  try {
    return buf.getShort();
  } catch (BufferUnderflowException e) {
    throw (EOFException)new EOFException().initCause(e);
  }
}

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

eof.initCause(ise);
  session.propogateError("Session closed while signing leaseset", eof);
} else {

代码示例来源:origin: ome/formats-common

@Override
public byte readByte() throws IOException {
 buffer(position, 1);
 position += 1;
 try {
  return buffer.get();
 } catch (BufferUnderflowException e) {
  EOFException eof = new EOFException(EOF_ERROR_MSG);
  eof.initCause(e);
  throw eof;
 }
}

代码示例来源:origin: ome/formats-common

@Override
public char readChar() throws IOException {
 buffer(position, 2);
 position += 2;
 try {
  return buffer.getChar();
 } catch (BufferUnderflowException e) {
  EOFException eof = new EOFException(EOF_ERROR_MSG);
  eof.initCause(e);
  throw eof;
 }
}

代码示例来源:origin: ome/formats-common

@Override
public int readInt() throws IOException {
 buffer(position, 4);
 position += 4;
 try {
  return buffer.getInt();
 } catch (BufferUnderflowException e) {
  EOFException eof = new EOFException(EOF_ERROR_MSG);
  eof.initCause(e);
  throw eof;
 }
}

相关文章