本文整理了Java中java.io.ObjectInputStream.available()
方法的一些代码示例,展示了ObjectInputStream.available()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectInputStream.available()
方法的具体详情如下:
包路径:java.io.ObjectInputStream
类名称:ObjectInputStream
方法名:available
[英]Returns the number of bytes that can be read without blocking.
[中]返回无阻塞情况下可以读取的字节数。
代码示例来源:origin: redisson/redisson
@Override
public int available() throws IOException {
return wrapped.available();
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public int available() throws IOException {
return ois.available();
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public int available() throws IOException {
return ois.available();
}
代码示例来源:origin: wildfly/wildfly
/** {@inheritDoc} */
public int available() throws IOException {
return ois.available();
}
代码示例来源:origin: RuedigerMoeller/fast-serialization
@Override
public int available() throws IOException {
return wrapped.available();
}
代码示例来源:origin: wildfly/wildfly
/**
* Load {@link #dataKeyStore} with data from the input stream.
*
* @param inputStream to load data from
* @throws IOException if something goes wrong
*/
void load(InputStream inputStream) throws IOException, GeneralSecurityException {
dataKeyStore.load(null, null);
ObjectInputStream ois = new ObjectInputStream(inputStream);
int fileVersion = ois.readInt();
if (fileVersion == VERSION) {
while (ois.available() > 0) {
int entryType = ois.readInt();
if (entryType == SECRET_KEY_ENTRY_TYPE) {
loadSecretKey(ois);
} else {
throw log.unrecognizedEntryType(Integer.toString(entryType));
}
}
} else {
throw log.unexpectedFileVersion(Integer.toString(fileVersion));
}
ois.close();
}
代码示例来源:origin: apache/hive
while (in.available() > 0) {
writable.readFields(in);
代码示例来源:origin: apache/drill
while (in.available() > 0) {
writable.readFields(in);
代码示例来源:origin: hector-client/hector
@Override
public Object fromByteBuffer(ByteBuffer bytes) {
if ((bytes == null) || !bytes.hasRemaining()) {
return null;
}
try {
int l = bytes.remaining();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes.array(),
bytes.arrayOffset() + bytes.position(), l);
ObjectInputStream ois;
if(classLoader == null) {
ois = new ObjectInputStream(bais);
} else {
ois = new CustomClassLoaderObjectInputStream(classLoader, bais);
}
Object obj = ois.readObject();
bytes.position(bytes.position() + (l - ois.available()));
ois.close();
return obj;
} catch (Exception ex) {
throw new HectorSerializationException(ex);
}
}
代码示例来源:origin: stackoverflow.com
while(in.available()>0){
offset=offset + in.read(bytesar, offset, in.available());
代码示例来源:origin: org.apache.ignite/ignite-core
/** {@inheritDoc} */
@Override public int available() throws IOException {
return ois.available();
}
代码示例来源:origin: jboss-remoting/jboss-marshalling
/** {@inheritDoc} */
public int available() throws IOException {
return ois.available();
}
代码示例来源:origin: org.jboss.marshalling/jboss-marshalling
/** {@inheritDoc} */
public int available() throws IOException {
return ois.available();
}
代码示例来源:origin: org.jboss.marshalling/jboss-marshalling-osgi
/** {@inheritDoc} */
public int available() throws IOException {
return ois.available();
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/** {@inheritDoc} */
public int available() throws IOException {
return ois.available();
}
代码示例来源:origin: stackoverflow.com
ObjectInputStream messages= new ObjectInputStream(new FileInputStream("serializer.txt"));
while(messages.available()){
MimeMessage message = (MimeMessage)messages.readObject()
....
}
代码示例来源:origin: stackoverflow.com
FileInputStream fstream = new FileInputStream(fileName);
try {
ObjectInputStream ostream = new ObjectInputStream(fstream);
while (ostream.available() > 0) {
Object obj = ostream.readObject();
// do something with obj
}
} finally {
fstream.close();
}
代码示例来源:origin: stackoverflow.com
List<Object> objects = new ArrayList<Object>();
ObjectInputStream input = new ObjectInputStream(new FileInputStream("path/to/file"));
while (input.available() > 0) {
Object anObject = input.readObject();
objects.add(anObject);
}
代码示例来源:origin: stackoverflow.com
public static void read(String fileName) throws FileNotFoundException, IOException,NumberFormatException {
try(ObjectInputStream i = new ObjectInputStream(new BufferedInputStream(new FileInputStream(fileName)))){
while (i.available()>0) {
int id=Integer.parseInt((readFixedLengthString(ID_SIZE,i)));
String name=readFixedLengthString(NAME_SIZE,i);
String grade=readFixedLengthString(GRADE_SIZE,i);
System.out.println(new Student<>(id, name,grade));
}
}
}
代码示例来源:origin: org.ihtsdo/wb-api
@Override
public int availableBytes() throws FileNotFoundException, IOException, ClassNotFoundException {
lazyInit();
if (ois != null) {
return ois.available();
}
return 0;
}
内容来源于网络,如有侵权,请联系作者删除!