public ByteBuffer map(long startPosition, long size) throws IOException { if (startPosition < 0 || size < 0) { throw new IOException("startPosition and size must both be >= 0"); } //make sure that start+size aren't greater than avail size //in raf. BigInteger end = BigInteger.valueOf(startPosition); end = end.add(BigInteger.valueOf(size)); if (end.compareTo(BigInteger.valueOf(raf.length())) > 0) { throw new IOException("requesting read past end of stream"); } raf.seek(startPosition); int payLoadSize = l2i(size); //hack to check for potential overflow if (Long.MAX_VALUE-payLoadSize < startPosition || Long.MAX_VALUE-payLoadSize > raf.length()) { throw new IOException("requesting read past end of stream"); } byte[] payload = new byte[payLoadSize]; raf.readFully(payload); return ByteBuffer.wrap(payload); }
public CencEncryptingSampleList( SecretKey defaultCek, List<Sample> parent, List<CencSampleAuxiliaryDataFormat> auxiliaryDataFormats) { this(new RangeStartMap<Integer, SecretKey>(0, defaultCek), parent, auxiliaryDataFormats, "cenc"); }
public static long lcm(long[] input) { long result = input[0]; for(int i = 1; i < input.length; i++) result = lcm(result, input[i]); return result; }
public static <T extends Box> List<T> getPaths(Container container, String path) { return getPaths(container, path, false); }
public static int lcm(int a, int b) { return a * (b / gcd(a, b)); }
public WebVTTConfigurationBox getConfig() { return Path.getPath(this, "vttC"); }
public static Matrix fromFileOrder(double a, double b, double u, double c, double d, double v, double tx, double ty, double w) { return new Matrix(a, b, c, d, u, v, w, tx, ty); }
public static String createPath(Box box) { return createPath(box, ""); }
public List<Box> getBoxes() { if (dataSource != null && lookahead != EOF) { return new LazyList<Box>(boxes, this); } else { return boxes; } }
private static <T extends Box> List<T> getPaths(Container container, String path, boolean singleResult) { return getPaths((Object) container, path, singleResult); }
public static long lcm(long a, long b) { return a * (b / gcd(a, b)); }
public WebVTTSourceLabelBox getSourceLabel() { return Path.getPath(this, "vlab"); } }
public static Matrix fromFileOrder(double a, double b, double u, double c, double d, double v, double tx, double ty, double w) { return new Matrix(a, b, c, d, u, v, w, tx, ty); }
public static String createPath(Box box) { return createPath(box, ""); }
public CencDecryptingSampleList(SecretKey secretKey, List<Sample> parent, List<CencSampleAuxiliaryDataFormat> sencInfo) { this(new RangeStartMap<Integer, SecretKey>(0, secretKey), parent, sencInfo, "cenc"); }
private static <T extends Box> List<T> getPaths(AbstractContainerBox container, String path, boolean singleResult) { return getPaths((Object) container, path, singleResult); }
public static long lcm(long a, long b) { return a * (b / gcd(a, b)); }
private static <T extends Box> List<T> getPaths(Box box, String path, boolean singleResult) { return getPaths((Object) box, path, singleResult); }
public static int lcm(int a, int b) { return a * (b / gcd(a, b)); }