25
26 package com.sun.jndi.ldap;
27
28 import java.io.UnsupportedEncodingException;
29
30 /**
31 * A BER decoder. Contains methods to parse a BER buffer.
32 *
33 * @author Jagane Sundar
34 * @author Vincent Ryan
35 */
36 public final class BerDecoder extends Ber {
37
38 private int origOffset; // The start point in buf to decode
39
40 /**
41 * Creates a BER decoder that reads bytes from the specified buffer.
42 */
43 public BerDecoder(byte buf[], int offset, int bufsize) {
44
45 this.buf = buf;
46 this.bufsize = bufsize;
47 this.origOffset = offset;
48
49 reset();
50 }
51
52 /**
53 * Resets this decode to start parsing from the initial offset
54 * (ie., same state as after calling the constructor).
55 */
56 public void reset() {
57 offset = origOffset;
58 }
59
60 /**
61 * Returns the current parse position.
62 * It points to the byte that will be parsed next.
63 * Useful for parsing sequences.
64 */
65 public int getParsePosition() {
|
25
26 package com.sun.jndi.ldap;
27
28 import java.io.UnsupportedEncodingException;
29
30 /**
31 * A BER decoder. Contains methods to parse a BER buffer.
32 *
33 * @author Jagane Sundar
34 * @author Vincent Ryan
35 */
36 public final class BerDecoder extends Ber {
37
38 private int origOffset; // The start point in buf to decode
39
40 /**
41 * Creates a BER decoder that reads bytes from the specified buffer.
42 */
43 public BerDecoder(byte buf[], int offset, int bufsize) {
44
45 this.buf = buf; // shared buffer, be careful to use this class
46 this.bufsize = bufsize;
47 this.origOffset = offset;
48
49 reset();
50 }
51
52 /**
53 * Resets this decode to start parsing from the initial offset
54 * (ie., same state as after calling the constructor).
55 */
56 public void reset() {
57 offset = origOffset;
58 }
59
60 /**
61 * Returns the current parse position.
62 * It points to the byte that will be parsed next.
63 * Useful for parsing sequences.
64 */
65 public int getParsePosition() {
|