home *** CD-ROM | disk | FTP | other *** search
- package sun.security.util;
-
- import java.io.ByteArrayInputStream;
- import java.io.IOException;
-
- class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
- DerInputBuffer(byte[] var1) {
- super(var1);
- }
-
- DerInputBuffer(byte[] var1, int var2, int var3) {
- super(var1);
- }
-
- DerInputBuffer dup() {
- try {
- DerInputBuffer var1 = (DerInputBuffer)this.clone();
- ((ByteArrayInputStream)var1).mark(Integer.MAX_VALUE);
- return var1;
- } catch (CloneNotSupportedException var2) {
- throw new IllegalArgumentException(((Throwable)var2).toString());
- }
- }
-
- int peek() throws IOException {
- if (super.pos >= super.count) {
- throw new IOException("out of data");
- } else {
- return super.buf[super.pos];
- }
- }
-
- public boolean equals(Object var1) {
- return var1 instanceof DerInputBuffer ? this.equals((DerInputBuffer)var1) : false;
- }
-
- boolean equals(DerInputBuffer var1) {
- int var2 = ((ByteArrayInputStream)this).available();
- if (this == var1) {
- return true;
- } else if (((ByteArrayInputStream)var1).available() != ((ByteArrayInputStream)this).available()) {
- return false;
- } else {
- for(int var3 = 0; var3 < var2; ++var3) {
- if (super.buf[super.pos + var3] != var1.buf[var1.pos + var3]) {
- return false;
- }
- }
-
- return true;
- }
- }
-
- void truncate(int var1) throws IOException {
- if (var1 > ((ByteArrayInputStream)this).available()) {
- throw new IOException("insufficient data");
- } else {
- super.count = super.pos + var1;
- }
- }
-
- BigInt getUnsigned(int var1) throws IOException {
- if (var1 > ((ByteArrayInputStream)this).available()) {
- throw new IOException("short read, getInteger");
- } else {
- if (super.buf[super.pos] == 0) {
- --var1;
- ((ByteArrayInputStream)this).skip(1L);
- }
-
- byte[] var2 = new byte[var1];
- System.arraycopy(super.buf, super.pos, var2, 0, var1);
- ((ByteArrayInputStream)this).skip((long)var1);
- return new BigInt(var2);
- }
- }
-
- byte[] getBitString() {
- if (super.pos < super.count && super.buf[super.pos] == 0) {
- int var1 = ((ByteArrayInputStream)this).available();
- byte[] var2 = new byte[var1 - 1];
- System.arraycopy(super.buf, super.pos + 1, var2, 0, var1 - 1);
- super.pos = super.count;
- return var2;
- } else {
- return null;
- }
- }
- }
-