Debian Codegraph @

src/org/tukaani/xz/BCJOptions.java

raw symbols SCIP
1 // SPDX-License-Identifier: 0BSD
2 // SPDX-FileCopyrightText: The XZ for Java authors and contributors
3 // SPDX-FileContributor: Lasse Collin <[email protected]>
4
5 package org.tukaani.xz;
6
7 abstract class BCJOptions extends FilterOptions {
8 private final int alignment;
9 int startOffset = 0;
10
11 BCJOptions(int alignment) {
12 this.alignment = alignment;
13 }
14
15 /**
16 * Sets the start offset for the address conversions.
17 * Normally this is useless so you shouldn't use this function.
18 * The default value is {@code 0}.
19 */
20 public void setStartOffset(int startOffset)
21 throws UnsupportedOptionsException {
22 if ((startOffset & (alignment - 1)) != 0)
23 throw new UnsupportedOptionsException(
24 "Start offset must be a multiple of " + alignment);
25
26 this.startOffset = startOffset;
27 }
28
29 /**
30 * Gets the start offset.
31 */
32 public int getStartOffset() {
33 return startOffset;
34 }
35
36 @Override
37 public int getEncoderMemoryUsage() {
38 return SimpleOutputStream.getMemoryUsage();
39 }
40
41 @Override
42 public int getDecoderMemoryUsage() {
43 return SimpleInputStream.getMemoryUsage();
44 }
45
46 @Override
47 public Object clone() {
48 try {
49 return super.clone();
50 } catch (CloneNotSupportedException e) {
51 assert false;
52 throw new RuntimeException();
53 }
54 }
55 }