@Override public int available() throws IOException { return in.available(); }
@Override public int available() throws IOException { return in.available(); }
@Override public int available() throws IOException { return in.available(); }
public int available() throws IOException { return this.din == null ? 0 : this.din.available(); }
public int available() throws IOException { return this.din == null ? 0 : this.din.available(); }
public int available() throws IOException { return this.din == null ? 0 : this.din.available(); }
@Override public boolean hasNext() { try { boolean next = in.available() > 0; if (!next) in.close(); return next; } catch (IOException e) { throw new RuntimeException(e); } }
@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(); }
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 ); }
@Override @SuppressForbidden("just delegating the call") public int available() throws IOException { return _currentSize - _currentPos + _is.available(); } private void fillNextBuffer() throws IOException {
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; }
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; }
@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; }
while (din.available() > 0 && type != ']') { final JsonValue val = parse(din, type); val.parent = result;
while (din.available() > 0 && type != ']') { final JsonValue val = parse(din, type); val.parent = result;
while (din.available() > 0 && type != '}') { final String key = parseString(din, true, type); final JsonValue child = parse(din, valueType == 0 ? din.readByte() : valueType);
while (din.available() > 0 && type != '}') { final String key = parseString(din, true, type); final JsonValue child = parse(din, valueType == 0 ? din.readByte() : valueType);
private void assertNoMoreInput(DataInputStream in) throws IOException { assertEquals(0, in.available()); } }
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); }
while (validate.available() > 0) { String deser = StringValue.readString(validate);