本文整理了Java中java.io.DataInputStream.available()
方法的一些代码示例,展示了DataInputStream.available()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataInputStream.available()
方法的具体详情如下:
包路径:java.io.DataInputStream
类名称:DataInputStream
方法名:available
暂无
代码示例来源:origin: netty/netty
@Override
public int available() throws IOException {
return in.available();
}
代码示例来源:origin: redisson/redisson
@Override
public int available() throws IOException {
return in.available();
}
代码示例来源:origin: wildfly/wildfly
@Override
public int available() throws IOException {
return in.available();
}
代码示例来源:origin: scouter-project/scouter
public int available() throws IOException {
return this.din == null ? 0 : this.din.available();
}
代码示例来源:origin: scouter-project/scouter
public int available() throws IOException {
return this.din == null ? 0 : this.din.available();
}
代码示例来源:origin: scouter-project/scouter
public int available() throws IOException {
return this.din == null ? 0 : this.din.available();
}
代码示例来源:origin: hankcs/HanLP
@Override
public boolean hasNext()
{
try
{
boolean next = in.available() > 0;
if (!next) in.close();
return next;
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
代码示例来源:origin: mpusher/mpush
@SuppressWarnings("unchecked")
private <T> T asObject(byte[] bytes) throws Exception {
ByteArrayInputStream byteIn = new ByteArrayInputStream(bytes);
DataInputStream in = new DataInputStream(byteIn);
byte[] body = new byte[in.available()];
in.readFully(body);
ObjectInputStream objectIn = new ObjectInputStream(new ByteArrayInputStream(body));
return (T) objectIn.readObject();
}
代码示例来源:origin: apache/usergrid
private static InputStream getCertificateStream () throws IOException {
InputStream in = ChopUtils.class.getClassLoader().getResourceAsStream( "runner.cer" );
DataInputStream dis = new DataInputStream( in );
byte[] bytes = new byte[ dis.available() ];
dis.readFully( bytes );
return new ByteArrayInputStream( bytes );
}
代码示例来源:origin: org.apache.poi/poi
@Override
@SuppressForbidden("just delegating the call")
public int available() throws IOException {
return _currentSize - _currentPos + _is.available();
}
private void fillNextBuffer() throws IOException {
代码示例来源:origin: redisson/redisson
private ClassBody getClassBody(Object task) {
Class<?> c = task.getClass();
ClassBody result = class2body.get(c);
if (result == null) {
String className = c.getName();
String classAsPath = className.replace('.', '/') + ".class";
InputStream classStream = c.getClassLoader().getResourceAsStream(classAsPath);
byte[] lambdaBody = null;
byte[] classBody;
try {
DataInputStream s = new DataInputStream(classStream);
classBody = new byte[s.available()];
s.readFully(classBody);
} catch (IOException e) {
throw new IllegalArgumentException(e);
} finally {
try {
classStream.close();
} catch (IOException e) {
// skip
}
}
result = new ClassBody(lambdaBody, classBody, className);
class2body.put(c, result);
}
return result;
}
代码示例来源:origin: redisson/redisson
private ClassBody getClassBody(Object task) {
Class<?> c = task.getClass();
ClassBody result = class2body.get(c);
if (result == null) {
String className = c.getName();
String classAsPath = className.replace('.', '/') + ".class";
InputStream classStream = c.getClassLoader().getResourceAsStream(classAsPath);
byte[] lambdaBody = null;
byte[] classBody;
try {
DataInputStream s = new DataInputStream(classStream);
classBody = new byte[s.available()];
s.readFully(classBody);
} catch (IOException e) {
throw new IllegalArgumentException(e);
} finally {
try {
classStream.close();
} catch (IOException e) {
// skip
}
}
result = new ClassBody(lambdaBody, classBody, className);
class2body.put(c, result);
}
return result;
}
代码示例来源:origin: apache/hbase
@Override
protected ByteBuffer internalDecodeKeyValues(DataInputStream source, int allocateHeaderLength,
int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) throws IOException {
int decompressedSize = source.readInt();
ByteBuffer buffer = ByteBuffer.allocate(decompressedSize +
allocateHeaderLength);
buffer.position(allocateHeaderLength);
FastDiffCompressionState state = new FastDiffCompressionState();
while (source.available() > skipLastBytes) {
uncompressSingleKeyValue(source, buffer, state);
afterDecodingKeyValue(source, buffer, decodingCtx);
}
if (source.available() != skipLastBytes) {
throw new IllegalStateException("Read too much bytes.");
}
return buffer;
}
代码示例来源:origin: libgdx/libgdx
while (din.available() > 0 && type != ']') {
final JsonValue val = parse(din, type);
val.parent = result;
代码示例来源:origin: libgdx/libgdx
while (din.available() > 0 && type != ']') {
final JsonValue val = parse(din, type);
val.parent = result;
代码示例来源:origin: libgdx/libgdx
while (din.available() > 0 && type != '}') {
final String key = parseString(din, true, type);
final JsonValue child = parse(din, valueType == 0 ? din.readByte() : valueType);
代码示例来源:origin: libgdx/libgdx
while (din.available() > 0 && type != '}') {
final String key = parseString(din, true, type);
final JsonValue child = parse(din, valueType == 0 ? din.readByte() : valueType);
代码示例来源:origin: apache/geode
private void assertNoMoreInput(DataInputStream in) throws IOException {
assertEquals(0, in.available());
}
}
代码示例来源:origin: apache/flink
public static final void testSerialization(String[] values) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
DataOutputStream serializer = new DataOutputStream(baos);
for (String value : values) {
StringValue.writeString(value, serializer);
}
serializer.close();
baos.close();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
DataInputStream deserializer = new DataInputStream(bais);
int num = 0;
while (deserializer.available() > 0) {
String deser = StringValue.readString(deserializer);
assertEquals("DeserializedString differs from original string.", values[num], deser);
num++;
}
assertEquals("Wrong number of deserialized values", values.length, num);
}
代码示例来源:origin: apache/flink
while (validate.available() > 0) {
String deser = StringValue.readString(validate);
内容来源于网络,如有侵权,请联系作者删除!