1 /* 2 * BCJOptions 3 * 4 * Author: Lasse Collin <lasse.collin@tukaani.org> 5 * 6 * This file has been put into the public domain. 7 * You can do whatever you want with this file. 8 */ 9 10 package org.tukaani.xz; 11 12 abstract class BCJOptions extends FilterOptions { 13 private final int alignment; 14 int startOffset = 0; 15 BCJOptions(int alignment)16 BCJOptions(int alignment) { 17 this.alignment = alignment; 18 } 19 20 /** 21 * Sets the start offset for the address conversions. 22 * Normally this is useless so you shouldn't use this function. 23 * The default value is <code>0</code>. 24 */ setStartOffset(int startOffset)25 public void setStartOffset(int startOffset) 26 throws UnsupportedOptionsException { 27 if ((startOffset & (alignment - 1)) != 0) 28 throw new UnsupportedOptionsException( 29 "Start offset must be a multiple of " + alignment); 30 31 this.startOffset = startOffset; 32 } 33 34 /** 35 * Gets the start offset. 36 */ getStartOffset()37 public int getStartOffset() { 38 return startOffset; 39 } 40 getEncoderMemoryUsage()41 public int getEncoderMemoryUsage() { 42 return SimpleOutputStream.getMemoryUsage(); 43 } 44 getDecoderMemoryUsage()45 public int getDecoderMemoryUsage() { 46 return SimpleInputStream.getMemoryUsage(); 47 } 48 clone()49 public Object clone() { 50 try { 51 return super.clone(); 52 } catch (CloneNotSupportedException e) { 53 assert false; 54 throw new RuntimeException(); 55 } 56 } 57 } 58