Commit fcbb6053 authored by Grigory Fedorov's avatar Grigory Fedorov

All java files reformatted with Android Studio.

parent 6a497074
......@@ -23,73 +23,73 @@ package com.google.zxing.integration.android;
*/
public final class IntentResult {
private final String contents;
private final String formatName;
private final byte[] rawBytes;
private final Integer orientation;
private final String errorCorrectionLevel;
private final String contents;
private final String formatName;
private final byte[] rawBytes;
private final Integer orientation;
private final String errorCorrectionLevel;
IntentResult() {
this(null, null, null, null, null);
}
IntentResult() {
this(null, null, null, null, null);
}
IntentResult(String contents,
String formatName,
byte[] rawBytes,
Integer orientation,
String errorCorrectionLevel) {
this.contents = contents;
this.formatName = formatName;
this.rawBytes = rawBytes;
this.orientation = orientation;
this.errorCorrectionLevel = errorCorrectionLevel;
}
IntentResult(String contents,
String formatName,
byte[] rawBytes,
Integer orientation,
String errorCorrectionLevel) {
this.contents = contents;
this.formatName = formatName;
this.rawBytes = rawBytes;
this.orientation = orientation;
this.errorCorrectionLevel = errorCorrectionLevel;
}
/**
* @return raw content of barcode
*/
public String getContents() {
return contents;
}
/**
* @return raw content of barcode
*/
public String getContents() {
return contents;
}
/**
* @return name of format, like "QR_CODE", "UPC_A". See {@code BarcodeFormat} for more format names.
*/
public String getFormatName() {
return formatName;
}
/**
* @return name of format, like "QR_CODE", "UPC_A". See {@code BarcodeFormat} for more format names.
*/
public String getFormatName() {
return formatName;
}
/**
* @return raw bytes of the barcode content, if applicable, or null otherwise
*/
public byte[] getRawBytes() {
return rawBytes;
}
/**
* @return raw bytes of the barcode content, if applicable, or null otherwise
*/
public byte[] getRawBytes() {
return rawBytes;
}
/**
* @return rotation of the image, in degrees, which resulted in a successful scan. May be null.
*/
public Integer getOrientation() {
return orientation;
}
/**
* @return rotation of the image, in degrees, which resulted in a successful scan. May be null.
*/
public Integer getOrientation() {
return orientation;
}
/**
* @return name of the error correction level used in the barcode, if applicable
*/
public String getErrorCorrectionLevel() {
return errorCorrectionLevel;
}
@Override
public String toString() {
StringBuilder dialogText = new StringBuilder(100);
dialogText.append("Format: ").append(formatName).append('\n');
dialogText.append("Contents: ").append(contents).append('\n');
int rawBytesLength = rawBytes == null ? 0 : rawBytes.length;
dialogText.append("Raw bytes: (").append(rawBytesLength).append(" bytes)\n");
dialogText.append("Orientation: ").append(orientation).append('\n');
dialogText.append("EC level: ").append(errorCorrectionLevel).append('\n');
return dialogText.toString();
}
/**
* @return name of the error correction level used in the barcode, if applicable
*/
public String getErrorCorrectionLevel() {
return errorCorrectionLevel;
}
@Override
public String toString() {
StringBuilder dialogText = new StringBuilder(100);
dialogText.append("Format: ").append(formatName).append('\n');
dialogText.append("Contents: ").append(contents).append('\n');
int rawBytesLength = rawBytes == null ? 0 : rawBytes.length;
dialogText.append("Raw bytes: (").append(rawBytesLength).append(" bytes)\n");
dialogText.append("Orientation: ").append(orientation).append('\n');
dialogText.append("EC level: ").append(errorCorrectionLevel).append('\n');
return dialogText.toString();
}
}
......@@ -34,53 +34,72 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.jcraft.jzlib;
final class Adler32{
final class Adler32 {
// largest prime smaller than 65536
static final private int BASE=65521;
// NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
static final private int NMAX=5552;
// largest prime smaller than 65536
static final private int BASE = 65521;
// NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
static final private int NMAX = 5552;
long adler32(long adler, byte[] buf, int index, int len){
if(buf == null){ return 1L; }
long adler32(long adler, byte[] buf, int index, int len) {
if (buf == null) {
return 1L;
}
long s1=adler&0xffff;
long s2=(adler>>16)&0xffff;
int k;
long s1 = adler & 0xffff;
long s2 = (adler >> 16) & 0xffff;
int k;
while(len > 0) {
k=len<NMAX?len:NMAX;
len-=k;
while(k>=16){
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
s1+=buf[index++]&0xff; s2+=s1;
k-=16;
}
if(k!=0){
do{
s1+=buf[index++]&0xff; s2+=s1;
while (len > 0) {
k = len < NMAX ? len : NMAX;
len -= k;
while (k >= 16) {
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
s1 += buf[index++] & 0xff;
s2 += s1;
k -= 16;
}
if (k != 0) {
do {
s1 += buf[index++] & 0xff;
s2 += s1;
}
while (--k != 0);
}
s1 %= BASE;
s2 %= BASE;
}
while(--k!=0);
}
s1%=BASE;
s2%=BASE;
return (s2 << 16) | s1;
}
return (s2<<16)|s1;
}
/*
private java.util.zip.Adler32 adler=new java.util.zip.Adler32();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -34,34 +34,37 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.jcraft.jzlib;
final public class JZlib{
private static final String version="1.0.2";
public static String version(){return version;}
final public class JZlib {
private static final String version = "1.0.2";
// compression levels
static final public int Z_NO_COMPRESSION=0;
static final public int Z_BEST_SPEED=1;
static final public int Z_BEST_COMPRESSION=9;
static final public int Z_DEFAULT_COMPRESSION=(-1);
public static String version() {
return version;
}
// compression strategy
static final public int Z_FILTERED=1;
static final public int Z_HUFFMAN_ONLY=2;
static final public int Z_DEFAULT_STRATEGY=0;
// compression levels
static final public int Z_NO_COMPRESSION = 0;
static final public int Z_BEST_SPEED = 1;
static final public int Z_BEST_COMPRESSION = 9;
static final public int Z_DEFAULT_COMPRESSION = (-1);
static final public int Z_NO_FLUSH=0;
static final public int Z_PARTIAL_FLUSH=1;
static final public int Z_SYNC_FLUSH=2;
static final public int Z_FULL_FLUSH=3;
static final public int Z_FINISH=4;
// compression strategy
static final public int Z_FILTERED = 1;
static final public int Z_HUFFMAN_ONLY = 2;
static final public int Z_DEFAULT_STRATEGY = 0;
static final public int Z_OK=0;
static final public int Z_STREAM_END=1;
static final public int Z_NEED_DICT=2;
static final public int Z_ERRNO=-1;
static final public int Z_STREAM_ERROR=-2;
static final public int Z_DATA_ERROR=-3;
static final public int Z_MEM_ERROR=-4;
static final public int Z_BUF_ERROR=-5;
static final public int Z_VERSION_ERROR=-6;
static final public int Z_NO_FLUSH = 0;
static final public int Z_PARTIAL_FLUSH = 1;
static final public int Z_SYNC_FLUSH = 2;
static final public int Z_FULL_FLUSH = 3;
static final public int Z_FINISH = 4;
static final public int Z_OK = 0;
static final public int Z_STREAM_END = 1;
static final public int Z_NEED_DICT = 2;
static final public int Z_ERRNO = -1;
static final public int Z_STREAM_ERROR = -2;
static final public int Z_DATA_ERROR = -3;
static final public int Z_MEM_ERROR = -4;
static final public int Z_BUF_ERROR = -5;
static final public int Z_VERSION_ERROR = -6;
}
......@@ -34,116 +34,116 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.jcraft.jzlib;
final class StaticTree{
static final private int MAX_BITS=15;
static final private int BL_CODES=19;
static final private int D_CODES=30;
static final private int LITERALS=256;
static final private int LENGTH_CODES=29;
static final private int L_CODES=(LITERALS+1+LENGTH_CODES);
// Bit length codes must not exceed MAX_BL_BITS bits
static final int MAX_BL_BITS=7;
static final short[] static_ltree = {
12, 8, 140, 8, 76, 8, 204, 8, 44, 8,
172, 8, 108, 8, 236, 8, 28, 8, 156, 8,
92, 8, 220, 8, 60, 8, 188, 8, 124, 8,
252, 8, 2, 8, 130, 8, 66, 8, 194, 8,
34, 8, 162, 8, 98, 8, 226, 8, 18, 8,
146, 8, 82, 8, 210, 8, 50, 8, 178, 8,
114, 8, 242, 8, 10, 8, 138, 8, 74, 8,
202, 8, 42, 8, 170, 8, 106, 8, 234, 8,
26, 8, 154, 8, 90, 8, 218, 8, 58, 8,
186, 8, 122, 8, 250, 8, 6, 8, 134, 8,
70, 8, 198, 8, 38, 8, 166, 8, 102, 8,
230, 8, 22, 8, 150, 8, 86, 8, 214, 8,
54, 8, 182, 8, 118, 8, 246, 8, 14, 8,
142, 8, 78, 8, 206, 8, 46, 8, 174, 8,
110, 8, 238, 8, 30, 8, 158, 8, 94, 8,
222, 8, 62, 8, 190, 8, 126, 8, 254, 8,
1, 8, 129, 8, 65, 8, 193, 8, 33, 8,
161, 8, 97, 8, 225, 8, 17, 8, 145, 8,
81, 8, 209, 8, 49, 8, 177, 8, 113, 8,
241, 8, 9, 8, 137, 8, 73, 8, 201, 8,
41, 8, 169, 8, 105, 8, 233, 8, 25, 8,
153, 8, 89, 8, 217, 8, 57, 8, 185, 8,
121, 8, 249, 8, 5, 8, 133, 8, 69, 8,
197, 8, 37, 8, 165, 8, 101, 8, 229, 8,
21, 8, 149, 8, 85, 8, 213, 8, 53, 8,
181, 8, 117, 8, 245, 8, 13, 8, 141, 8,
77, 8, 205, 8, 45, 8, 173, 8, 109, 8,
237, 8, 29, 8, 157, 8, 93, 8, 221, 8,
61, 8, 189, 8, 125, 8, 253, 8, 19, 9,
275, 9, 147, 9, 403, 9, 83, 9, 339, 9,
211, 9, 467, 9, 51, 9, 307, 9, 179, 9,
435, 9, 115, 9, 371, 9, 243, 9, 499, 9,
11, 9, 267, 9, 139, 9, 395, 9, 75, 9,
331, 9, 203, 9, 459, 9, 43, 9, 299, 9,
171, 9, 427, 9, 107, 9, 363, 9, 235, 9,
491, 9, 27, 9, 283, 9, 155, 9, 411, 9,
91, 9, 347, 9, 219, 9, 475, 9, 59, 9,
315, 9, 187, 9, 443, 9, 123, 9, 379, 9,
251, 9, 507, 9, 7, 9, 263, 9, 135, 9,
391, 9, 71, 9, 327, 9, 199, 9, 455, 9,
39, 9, 295, 9, 167, 9, 423, 9, 103, 9,
359, 9, 231, 9, 487, 9, 23, 9, 279, 9,
151, 9, 407, 9, 87, 9, 343, 9, 215, 9,
471, 9, 55, 9, 311, 9, 183, 9, 439, 9,
119, 9, 375, 9, 247, 9, 503, 9, 15, 9,
271, 9, 143, 9, 399, 9, 79, 9, 335, 9,
207, 9, 463, 9, 47, 9, 303, 9, 175, 9,
431, 9, 111, 9, 367, 9, 239, 9, 495, 9,
31, 9, 287, 9, 159, 9, 415, 9, 95, 9,
351, 9, 223, 9, 479, 9, 63, 9, 319, 9,
191, 9, 447, 9, 127, 9, 383, 9, 255, 9,
511, 9, 0, 7, 64, 7, 32, 7, 96, 7,
16, 7, 80, 7, 48, 7, 112, 7, 8, 7,
72, 7, 40, 7, 104, 7, 24, 7, 88, 7,
56, 7, 120, 7, 4, 7, 68, 7, 36, 7,
100, 7, 20, 7, 84, 7, 52, 7, 116, 7,
3, 8, 131, 8, 67, 8, 195, 8, 35, 8,
163, 8, 99, 8, 227, 8
};
static final short[] static_dtree = {
0, 5, 16, 5, 8, 5, 24, 5, 4, 5,
20, 5, 12, 5, 28, 5, 2, 5, 18, 5,
10, 5, 26, 5, 6, 5, 22, 5, 14, 5,
30, 5, 1, 5, 17, 5, 9, 5, 25, 5,
5, 5, 21, 5, 13, 5, 29, 5, 3, 5,
19, 5, 11, 5, 27, 5, 7, 5, 23, 5
};
static StaticTree static_l_desc =
new StaticTree(static_ltree, Tree.extra_lbits,
LITERALS+1, L_CODES, MAX_BITS);
static StaticTree static_d_desc =
new StaticTree(static_dtree, Tree.extra_dbits,
0, D_CODES, MAX_BITS);
static StaticTree static_bl_desc =
new StaticTree(null, Tree.extra_blbits,
0, BL_CODES, MAX_BL_BITS);
short[] static_tree; // static tree or null
int[] extra_bits; // extra bits for each code or null
int extra_base; // base index for extra_bits
int elems; // max number of elements in the tree
int max_length; // max bit length for the codes
StaticTree(short[] static_tree,
int[] extra_bits,
int extra_base,
int elems,
int max_length
){
this.static_tree=static_tree;
this.extra_bits=extra_bits;
this.extra_base=extra_base;
this.elems=elems;
this.max_length=max_length;
}
final class StaticTree {
static final private int MAX_BITS = 15;
static final private int BL_CODES = 19;
static final private int D_CODES = 30;
static final private int LITERALS = 256;
static final private int LENGTH_CODES = 29;
static final private int L_CODES = (LITERALS + 1 + LENGTH_CODES);
// Bit length codes must not exceed MAX_BL_BITS bits
static final int MAX_BL_BITS = 7;
static final short[] static_ltree = {
12, 8, 140, 8, 76, 8, 204, 8, 44, 8,
172, 8, 108, 8, 236, 8, 28, 8, 156, 8,
92, 8, 220, 8, 60, 8, 188, 8, 124, 8,
252, 8, 2, 8, 130, 8, 66, 8, 194, 8,
34, 8, 162, 8, 98, 8, 226, 8, 18, 8,
146, 8, 82, 8, 210, 8, 50, 8, 178, 8,
114, 8, 242, 8, 10, 8, 138, 8, 74, 8,
202, 8, 42, 8, 170, 8, 106, 8, 234, 8,
26, 8, 154, 8, 90, 8, 218, 8, 58, 8,
186, 8, 122, 8, 250, 8, 6, 8, 134, 8,
70, 8, 198, 8, 38, 8, 166, 8, 102, 8,
230, 8, 22, 8, 150, 8, 86, 8, 214, 8,
54, 8, 182, 8, 118, 8, 246, 8, 14, 8,
142, 8, 78, 8, 206, 8, 46, 8, 174, 8,
110, 8, 238, 8, 30, 8, 158, 8, 94, 8,
222, 8, 62, 8, 190, 8, 126, 8, 254, 8,
1, 8, 129, 8, 65, 8, 193, 8, 33, 8,
161, 8, 97, 8, 225, 8, 17, 8, 145, 8,
81, 8, 209, 8, 49, 8, 177, 8, 113, 8,
241, 8, 9, 8, 137, 8, 73, 8, 201, 8,
41, 8, 169, 8, 105, 8, 233, 8, 25, 8,
153, 8, 89, 8, 217, 8, 57, 8, 185, 8,
121, 8, 249, 8, 5, 8, 133, 8, 69, 8,
197, 8, 37, 8, 165, 8, 101, 8, 229, 8,
21, 8, 149, 8, 85, 8, 213, 8, 53, 8,
181, 8, 117, 8, 245, 8, 13, 8, 141, 8,
77, 8, 205, 8, 45, 8, 173, 8, 109, 8,
237, 8, 29, 8, 157, 8, 93, 8, 221, 8,
61, 8, 189, 8, 125, 8, 253, 8, 19, 9,
275, 9, 147, 9, 403, 9, 83, 9, 339, 9,
211, 9, 467, 9, 51, 9, 307, 9, 179, 9,
435, 9, 115, 9, 371, 9, 243, 9, 499, 9,
11, 9, 267, 9, 139, 9, 395, 9, 75, 9,
331, 9, 203, 9, 459, 9, 43, 9, 299, 9,
171, 9, 427, 9, 107, 9, 363, 9, 235, 9,
491, 9, 27, 9, 283, 9, 155, 9, 411, 9,
91, 9, 347, 9, 219, 9, 475, 9, 59, 9,
315, 9, 187, 9, 443, 9, 123, 9, 379, 9,
251, 9, 507, 9, 7, 9, 263, 9, 135, 9,
391, 9, 71, 9, 327, 9, 199, 9, 455, 9,
39, 9, 295, 9, 167, 9, 423, 9, 103, 9,
359, 9, 231, 9, 487, 9, 23, 9, 279, 9,
151, 9, 407, 9, 87, 9, 343, 9, 215, 9,
471, 9, 55, 9, 311, 9, 183, 9, 439, 9,
119, 9, 375, 9, 247, 9, 503, 9, 15, 9,
271, 9, 143, 9, 399, 9, 79, 9, 335, 9,
207, 9, 463, 9, 47, 9, 303, 9, 175, 9,
431, 9, 111, 9, 367, 9, 239, 9, 495, 9,
31, 9, 287, 9, 159, 9, 415, 9, 95, 9,
351, 9, 223, 9, 479, 9, 63, 9, 319, 9,
191, 9, 447, 9, 127, 9, 383, 9, 255, 9,
511, 9, 0, 7, 64, 7, 32, 7, 96, 7,
16, 7, 80, 7, 48, 7, 112, 7, 8, 7,
72, 7, 40, 7, 104, 7, 24, 7, 88, 7,
56, 7, 120, 7, 4, 7, 68, 7, 36, 7,
100, 7, 20, 7, 84, 7, 52, 7, 116, 7,
3, 8, 131, 8, 67, 8, 195, 8, 35, 8,
163, 8, 99, 8, 227, 8
};
static final short[] static_dtree = {
0, 5, 16, 5, 8, 5, 24, 5, 4, 5,
20, 5, 12, 5, 28, 5, 2, 5, 18, 5,
10, 5, 26, 5, 6, 5, 22, 5, 14, 5,
30, 5, 1, 5, 17, 5, 9, 5, 25, 5,
5, 5, 21, 5, 13, 5, 29, 5, 3, 5,
19, 5, 11, 5, 27, 5, 7, 5, 23, 5
};
static StaticTree static_l_desc =
new StaticTree(static_ltree, Tree.extra_lbits,
LITERALS + 1, L_CODES, MAX_BITS);
static StaticTree static_d_desc =
new StaticTree(static_dtree, Tree.extra_dbits,
0, D_CODES, MAX_BITS);
static StaticTree static_bl_desc =
new StaticTree(null, Tree.extra_blbits,
0, BL_CODES, MAX_BL_BITS);
short[] static_tree; // static tree or null
int[] extra_bits; // extra bits for each code or null
int extra_base; // base index for extra_bits
int elems; // max number of elements in the tree
int max_length; // max bit length for the codes
StaticTree(short[] static_tree,
int[] extra_bits,
int extra_base,
int elems,
int max_length
) {
this.static_tree = static_tree;
this.extra_bits = extra_bits;
this.extra_base = extra_base;
this.elems = elems;
this.max_length = max_length;
}
}
......@@ -33,117 +33,119 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jcraft.jzlib;
import java.io.*;
public class ZInputStream extends FilterInputStream {
protected ZStream z=new ZStream();
protected int bufsize=512;
protected int flush=JZlib.Z_NO_FLUSH;
protected byte[] buf=new byte[bufsize],
buf1=new byte[1];
protected boolean compress;
protected InputStream in=null;
public ZInputStream(InputStream in) {
this(in, false);
}
public ZInputStream(InputStream in, boolean nowrap) {
super(in);
this.in=in;
z.inflateInit(nowrap);
compress=false;
z.next_in=buf;
z.next_in_index=0;
z.avail_in=0;
}
public ZInputStream(InputStream in, int level) {
super(in);
this.in=in;
z.deflateInit(level);
compress=true;
z.next_in=buf;
z.next_in_index=0;
z.avail_in=0;
}
protected ZStream z = new ZStream();
protected int bufsize = 512;
protected int flush = JZlib.Z_NO_FLUSH;
protected byte[] buf = new byte[bufsize],
buf1 = new byte[1];
protected boolean compress;
protected InputStream in = null;
public ZInputStream(InputStream in) {
this(in, false);
}
public ZInputStream(InputStream in, boolean nowrap) {
super(in);
this.in = in;
z.inflateInit(nowrap);
compress = false;
z.next_in = buf;
z.next_in_index = 0;
z.avail_in = 0;
}
public ZInputStream(InputStream in, int level) {
super(in);
this.in = in;
z.deflateInit(level);
compress = true;
z.next_in = buf;
z.next_in_index = 0;
z.avail_in = 0;
}
/*public int available() throws IOException {
return inf.finished() ? 0 : 1;
}*/
public int read() throws IOException {
if(read(buf1, 0, 1)==-1)
return(-1);
return(buf1[0]&0xFF);
}
private boolean nomoreinput=false;
public int read(byte[] b, int off, int len) throws IOException {
if(len==0)
return(0);
int err;
z.next_out=b;
z.next_out_index=off;
z.avail_out=len;
do {
if((z.avail_in==0)&&(!nomoreinput)) { // if buffer is empty and more input is avaiable, refill it
z.next_in_index=0;
z.avail_in=in.read(buf, 0, bufsize);//(bufsize<z.avail_out ? bufsize : z.avail_out));
if(z.avail_in==-1) {
z.avail_in=0;
nomoreinput=true;
}
}
if(compress)
err=z.deflate(flush);
else
err=z.inflate(flush);
if(nomoreinput&&(err==JZlib.Z_BUF_ERROR))
return(-1);
if(err!=JZlib.Z_OK && err!=JZlib.Z_STREAM_END)
throw new ZStreamException((compress ? "de" : "in")+"flating: "+z.msg);
if((nomoreinput||err==JZlib.Z_STREAM_END)&&(z.avail_out==len))
return(-1);
}
while(z.avail_out==len&&err==JZlib.Z_OK);
//System.err.print("("+(len-z.avail_out)+")");
return(len-z.avail_out);
}
public long skip(long n) throws IOException {
int len=512;
if(n<len)
len=(int)n;
byte[] tmp=new byte[len];
return((long)read(tmp));
}
public int getFlushMode() {
return(flush);
}
public void setFlushMode(int flush) {
this.flush=flush;
}
/**
* Returns the total number of bytes input so far.
*/
public long getTotalIn() {
return z.total_in;
}
/**
* Returns the total number of bytes output so far.
*/
public long getTotalOut() {
return z.total_out;
}
public void close() throws IOException{
in.close();
}
public int read() throws IOException {
if (read(buf1, 0, 1) == -1)
return (-1);
return (buf1[0] & 0xFF);
}
private boolean nomoreinput = false;
public int read(byte[] b, int off, int len) throws IOException {
if (len == 0)
return (0);
int err;
z.next_out = b;
z.next_out_index = off;
z.avail_out = len;
do {
if ((z.avail_in == 0) && (!nomoreinput)) { // if buffer is empty and more input is avaiable, refill it
z.next_in_index = 0;
z.avail_in = in.read(buf, 0, bufsize);//(bufsize<z.avail_out ? bufsize : z.avail_out));
if (z.avail_in == -1) {
z.avail_in = 0;
nomoreinput = true;
}
}
if (compress)
err = z.deflate(flush);
else
err = z.inflate(flush);
if (nomoreinput && (err == JZlib.Z_BUF_ERROR))
return (-1);
if (err != JZlib.Z_OK && err != JZlib.Z_STREAM_END)
throw new ZStreamException((compress ? "de" : "in") + "flating: " + z.msg);
if ((nomoreinput || err == JZlib.Z_STREAM_END) && (z.avail_out == len))
return (-1);
}
while (z.avail_out == len && err == JZlib.Z_OK);
//System.err.print("("+(len-z.avail_out)+")");
return (len - z.avail_out);
}
public long skip(long n) throws IOException {
int len = 512;
if (n < len)
len = (int) n;
byte[] tmp = new byte[len];
return ((long) read(tmp));
}
public int getFlushMode() {
return (flush);
}
public void setFlushMode(int flush) {
this.flush = flush;
}
/**
* Returns the total number of bytes input so far.
*/
public long getTotalIn() {
return z.total_in;
}
/**
* Returns the total number of bytes output so far.
*/
public long getTotalOut() {
return z.total_out;
}
public void close() throws IOException {
in.close();
}
}
......@@ -35,10 +35,11 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.jcraft.jzlib;
public class ZStreamException extends java.io.IOException {
public ZStreamException() {
super();
}
public ZStreamException(String s) {
super(s);
}
public ZStreamException() {
super();
}
public ZStreamException(String s) {
super(s);
}
}
......@@ -18,37 +18,32 @@ package com.novell.sasl.client;
* Implements the ParsedDirective class which will be used in the
* DigestMD5SaslClient mechanism.
*/
class ParsedDirective
{
public static final int QUOTED_STRING_VALUE = 1;
public static final int TOKEN_VALUE = 2;
class ParsedDirective {
public static final int QUOTED_STRING_VALUE = 1;
public static final int TOKEN_VALUE = 2;
private int m_valueType;
private String m_name;
private String m_value;
private int m_valueType;
private String m_name;
private String m_value;
ParsedDirective(
String name,
String value,
int type)
{
String name,
String value,
int type) {
m_name = name;
m_value = value;
m_valueType = type;
}
String getValue()
{
String getValue() {
return m_value;
}
String getName()
{
String getName() {
return m_name;
}
int getValueType()
{
int getValueType() {
return m_valueType;
}
......
/**
* Copyright (c) 2013, Redsolution LTD. All rights reserved.
*
*
* This file is part of Xabber project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License, Version 3.
*
*
* Xabber is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License,
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
......@@ -16,9 +16,8 @@ package com.xabber.android.data;
/**
* Base interface common for the registered manager.
*
*
* @author alexander.ivanov
*
*/
public interface BaseManagerInterface {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment