QCOW2Utils { public static long getVirtualSize(InputStream inputStream) throws IOException { byte[] bytes = new byte[VIRTUALSIZE_HEADER_LENGTH]; if (inputStream.skip(VIRTUALSIZE_HEADER_LOCATION) != VIRTUALSIZE_HEADER_LOCATION) { throw new IOException("Unable to skip to the virtual size header"); } if (inputStream.read(bytes) != VIRTUALSIZE_HEADER_LENGTH) { throw new IOException("Unable to properly read the size"); } return NumbersUtil.bytesToLong(bytes); } private  QCOW2Utils(); static int getVirtualSizeHeaderLocation(); static long getVirtualSize(InputStream inputStream);  }
@Test public void getVirtualSizeTest() throws IOException { assertEquals(virtualSize.longValue(), QCOW2Utils.getVirtualSize(inputStream)); }