public int skipBytes(int n) throws IOException { return mDelegate.skipBytes(n); }
@Override public int skipBytes(int n) { try { return input.skipBytes(n); } catch (IOException e) { throw new IllegalStateException(e); } }
private void skipBytes(int num) throws IOException { while (num > 0) { num -= in.skipBytes(num); } }
public int skipBytes(int n) throws IOException { return mDelegate.skipBytes(n); }
private void readAccessFlags(final DataInput di) throws IOException { di.skipBytes(2); // u2 }
private void readSuperClass(final DataInput di) throws IOException { di.skipBytes(2); // u2 }
@Override public int skipBytes(int n) { try { return input.skipBytes(n); } catch (IOException e) { throw new IllegalStateException(e); } }
@Override public int skipBytes(int n) { try { return input.skipBytes(n); } catch (IOException e) { throw new IllegalStateException(e); } }
private void find9patchChunk(DataInput di) throws JadxException, IOException { di.skipBytes(8); while (true) { int size; try { size = di.readInt(); } catch (IOException ex) { throw new JadxException("Cant find nine patch chunk", ex); } if (di.readInt() == NP_CHUNK_TYPE) { return; } di.skipBytes(size + 4); } }
private void readInterfaces(final DataInput di) throws IOException { final int count = di.readUnsignedShort(); di.skipBytes(count * 2); // count * u2 }
@Override public int skipBytes(int n) { try { return input.skipBytes(n); } catch (IOException e) { throw new IllegalStateException(e); } }
/** * Skip <i>len</i> number of bytes in input stream<i>in</i> * @param in input stream * @param len number of bytes to skip * @throws IOException when skipped less number of bytes */ public static void skipFully(DataInput in, int len) throws IOException { int total = 0; int cur = 0; while ((total < len) && ((cur = in.skipBytes(len - total)) > 0)) { total += cur; } if (total < len) { throw new IOException("Not able to skip " + len + " bytes, possibly " + "due to end of input."); } } }
public static void skipBytesFully(DataInput in, int bytes) throws IOException { int n = 0; while (n < bytes) { int skipped = in.skipBytes(bytes - n); if (skipped == 0) throw new EOFException("EOF after " + n + " bytes out of " + bytes); n += skipped; } }
/** * Skip <i>len</i> number of bytes in input stream<i>in</i> * * @param in input stream * @param len number of bytes to skip * @throws IOException when skipped less number of bytes */ public static void skipFully(DataInput in, int len) throws IOException { int total = 0; int cur = 0; while ((total < len) && ((cur = in.skipBytes(len - total)) > 0)) { total += cur; } if (total < len) { throw new IOException("Not able to skip " + len + " bytes, possibly " + "due to end of input."); } } }
private void find9patchChunk(DataInput di, int magic) throws AndrolibException, IOException { di.skipBytes(8); while (true) { int size; try { size = di.readInt(); } catch (IOException ex) { throw new CantFind9PatchChunk("Cant find nine patch chunk", ex); } if (di.readInt() == magic) { return; } di.skipBytes(size + 4); } }
/** * Skips an integer without reading it. */ public void skip() throws IOException { final int read = di.readInt(); if (read != di.skipBytes(read)) { throw new IOException(String.format("Failed to skip %d bytes", read)); } }
@Override public void readFields(DataInput in) throws IOException { short len = in.readShort(); if (len < THREE_LONGS) throw new IOException("Need at least " + THREE_LONGS + " bytes"); pathHash = in.readLong(); modTime = in.readLong(); length = in.readLong(); int extraBytes = len - THREE_LONGS; if (extraBytes > 0) { in.skipBytes(extraBytes); } } }
private void readVersion(final DataInput di) throws IOException { // sequence: minor version, major version (argument_index is 1-based) if (logger.isDebugEnabled()) { print("Java Class version %2$d.%1$d", di.readUnsignedShort(), di.readUnsignedShort()); } else { di.skipBytes(4); } }
private String readAnnotation(final DataInput di) throws IOException { final String rawTypeName = resolveUtf8(di); // num_element_value_pairs final int count = di.readUnsignedShort(); print("annotation elements count: %d", count); for (int i = 0; i < count; ++i) { if (logger.isDebugEnabled()) { print("element '%s'", resolveUtf8(di)); } else { di.skipBytes(2); } readAnnotationElementValue(di); } return rawTypeName; }
public void testSkipBytes() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(baos); /* Write out various test values NORMALLY */ out.write(new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); // 10 bytes of junk to skip initializeData(out); byte[] data = baos.toByteArray(); DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(data)); int bytesSkipped = 0; while (bytesSkipped < 10) { bytesSkipped += in.skipBytes(10 - bytesSkipped); } /* Read in various values in LITTLE ENDIAN FORMAT */ byte[] b = new byte[2]; in.readFully(b); assertEquals(-100, b[0]); assertEquals(100, b[1]); assertTrue(in.readBoolean()); assertFalse(in.readBoolean()); } }