aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/spongycastle/core/src/main/jdk1.3/org/spongycastle/asn1/StreamUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/spongycastle/core/src/main/jdk1.3/org/spongycastle/asn1/StreamUtil.java')
-rw-r--r--libraries/spongycastle/core/src/main/jdk1.3/org/spongycastle/asn1/StreamUtil.java89
1 files changed, 0 insertions, 89 deletions
diff --git a/libraries/spongycastle/core/src/main/jdk1.3/org/spongycastle/asn1/StreamUtil.java b/libraries/spongycastle/core/src/main/jdk1.3/org/spongycastle/asn1/StreamUtil.java
deleted file mode 100644
index 0b0b183e6..000000000
--- a/libraries/spongycastle/core/src/main/jdk1.3/org/spongycastle/asn1/StreamUtil.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.spongycastle.asn1;
-
-import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-class StreamUtil
-{
- /**
- * Find out possible longest length...
- *
- * @param in input stream of interest
- * @return length calculation or MAX_VALUE.
- */
- static int findLimit(InputStream in)
- {
- if (in instanceof LimitedInputStream)
- {
- return ((LimitedInputStream)in).getRemaining();
- }
- else if (in instanceof ASN1InputStream)
- {
- return ((ASN1InputStream)in).getLimit();
- }
- else if (in instanceof ByteArrayInputStream)
- {
- return ((ByteArrayInputStream)in).available();
- }
-
- return Integer.MAX_VALUE;
- }
-
- static int calculateBodyLength(
- int length)
- {
- int count = 1;
-
- if (length > 127)
- {
- int size = 1;
- int val = length;
-
- while ((val >>>= 8) != 0)
- {
- size++;
- }
-
- for (int i = (size - 1) * 8; i >= 0; i -= 8)
- {
- count++;
- }
- }
-
- return count;
- }
-
- static int calculateTagLength(int tagNo)
- throws IOException
- {
- int length = 1;
-
- if (tagNo >= 31)
- {
- if (tagNo < 128)
- {
- length++;
- }
- else
- {
- byte[] stack = new byte[5];
- int pos = stack.length;
-
- stack[--pos] = (byte)(tagNo & 0x7F);
-
- do
- {
- tagNo >>= 7;
- stack[--pos] = (byte)(tagNo & 0x7F | 0x80);
- }
- while (tagNo > 127);
-
- length += stack.length - pos;
- }
- }
-
- return length;
- }
-}