source: josm/trunk/src/org/tukaani/xz/MemoryLimitException.java@ 13928

Last change on this file since 13928 was 13350, checked in by stoecker, 7 years ago

see #15816 - add XZ support

File size: 1.7 KB
Line 
1/*
2 * MemoryLimitException
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
10package org.tukaani.xz;
11
12/**
13 * Thrown when the memory usage limit given to the XZ decompressor
14 * would be exceeded.
15 * <p>
16 * The amount of memory required and the memory usage limit are
17 * included in the error detail message in human readable format.
18 */
19public class MemoryLimitException extends XZIOException {
20 private static final long serialVersionUID = 3L;
21
22 private final int memoryNeeded;
23 private final int memoryLimit;
24
25 /**
26 * Creates a new MemoryLimitException.
27 * <p>
28 * The amount of memory needed and the memory usage limit are
29 * included in the error detail message.
30 *
31 * @param memoryNeeded amount of memory needed as kibibytes (KiB)
32 * @param memoryLimit specified memory usage limit as kibibytes (KiB)
33 */
34 public MemoryLimitException(int memoryNeeded, int memoryLimit) {
35 super("" + memoryNeeded + " KiB of memory would be needed; limit was "
36 + memoryLimit + " KiB");
37
38 this.memoryNeeded = memoryNeeded;
39 this.memoryLimit = memoryLimit;
40 }
41
42 /**
43 * Gets how much memory is required to decompress the data.
44 *
45 * @return amount of memory needed as kibibytes (KiB)
46 */
47 public int getMemoryNeeded() {
48 return memoryNeeded;
49 }
50
51 /**
52 * Gets what the memory usage limit was at the time the exception
53 * was created.
54 *
55 * @return memory usage limit as kibibytes (KiB)
56 */
57 public int getMemoryLimit() {
58 return memoryLimit;
59 }
60}
Note: See TracBrowser for help on using the repository browser.