java.io.ObjectInputStream.read()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(109)

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

ObjectInputStream.read介绍

[英]Reads a single byte from the source stream and returns it as an integer in the range from 0 to 255. Returns -1 if the end of the source stream has been reached. Blocks if no input is available.
[中]

代码示例

代码示例来源:origin: redisson/redisson

@Override
public int read(byte[] b) throws IOException {
  return wrapped.read(b);
}

代码示例来源:origin: wildfly/wildfly

private byte[] readBytes(ObjectInputStream ois) throws IOException {
  int len = ois.readInt();
  byte[] data = new byte[len];
  int actualLen = ois.read(data, 0, len);
  if (len != actualLen) throw log.readBytesMismatch(actualLen, len);
  return data;
}

代码示例来源:origin: square/okio

private Object deserialize(ByteString byteString) throws IOException, ClassNotFoundException {
 Buffer buffer = new Buffer();
 buffer.write(byteString);
 try (ObjectInputStream objectIn = new ObjectInputStream(buffer.inputStream())) {
  Object result = objectIn.readObject();
  if (objectIn.read() != -1) throw new IOException("Unconsumed bytes in stream");
  return result;
 }
}

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

private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
  int length = stream.readInt();
  byte[] trieBytes = new byte[length];
  int currentCount;
  int idx = 0;
  while ((currentCount = stream.read(trieBytes, idx, length - idx)) > 0) {
    idx += currentCount;
  }
  init(trieBytes);
}

代码示例来源:origin: redisson/redisson

@Override
public int read() throws IOException {
  return wrapped.read();
}

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

/** {@inheritDoc} */
  private void readObject(ObjectInputStream in) throws IOException {
    try {
      byte[] arr = new byte[in.readInt()];
      in.read(arr);
      str = unmarshal(arr);
      val = in.readInt();
    }
    catch (IgniteCheckedException e) {
      throw new IOException(e);
    }
  }
}

代码示例来源:origin: redisson/redisson

@Override
public int read(byte[] buf, int off, int len) throws IOException {
  return wrapped.read(buf, off, len);
}

代码示例来源:origin: protostuff/protostuff

private void readObject(ObjectInputStream in) throws IOException
{
  int length = in.readInt();
  byte[] data = new byte[length];
  for (int offset = 0; length > 0; length -= offset)
    offset = in.read(data, offset, length);
  in.close();
  ProtostuffIOUtil.mergeFrom(data, this,
      RuntimeSchema.getSchema(PojoWithArrayAndSet.class));
}

代码示例来源:origin: wildfly/wildfly

/** {@inheritDoc} */
public int read() throws IOException {
  return ois.read();
}

代码示例来源:origin: wildfly/wildfly

/** {@inheritDoc} */
public int read(final byte[] b) throws IOException {
  return ois.read(b);
}

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

/** {@inheritDoc} */
@Override public int read(byte[] b, int off, int len) throws IOException {
  return ois.read(b, off, len);
}

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

/** {@inheritDoc} */
@Override public int read() throws IOException {
  return ois.read();
}

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

/** {@inheritDoc} */
@Override public int read(byte[] b) throws IOException {
  return ois.read(b);
}

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

/** {@inheritDoc} */
@Override public int read(byte[] b, int off, int len) throws IOException {
  return ois.read(b, off, len);
}

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

/** {@inheritDoc} */
@Override public int read() throws IOException {
  return ois.read();
}

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

/** {@inheritDoc} */
@Override public int read(byte[] b) throws IOException {
  return ois.read(b);
}

代码示例来源:origin: wildfly/wildfly

/** {@inheritDoc} */
public int read(final byte[] buf, final int off, final int len) throws IOException {
  return ois.read(buf, off, len);
}

代码示例来源:origin: RuedigerMoeller/fast-serialization

@Override
public int read(byte[] b) throws IOException {
  return wrapped.read(b);
}

代码示例来源:origin: RuedigerMoeller/fast-serialization

@Override
public int read(byte[] buf, int off, int len) throws IOException {
  return wrapped.read(buf, off, len);
}

代码示例来源:origin: RuedigerMoeller/fast-serialization

@Override
public int read() throws IOException {
  return wrapped.read();
}

相关文章

ObjectInputStream类方法