summaryrefslogtreecommitdiff
path: root/smccTest/src/test/java/at/gv/egiz/pkcs15test/TLVSequence.java
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-11-05 12:48:37 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2010-11-05 12:48:37 +0000
commit7229336487111d6b17fb2693e6a9ef52283c08c9 (patch)
tree81d9da83d2d3b990dae2fa5ff3b4aa833993786f /smccTest/src/test/java/at/gv/egiz/pkcs15test/TLVSequence.java
parent33b5e4d5edbebe228281eef9d8c62bebd01bd396 (diff)
downloadmocca-7229336487111d6b17fb2693e6a9ef52283c08c9.tar.gz
mocca-7229336487111d6b17fb2693e6a9ef52283c08c9.tar.bz2
mocca-7229336487111d6b17fb2693e6a9ef52283c08c9.zip
mv PKCS15Test to main classes (distribute jar)
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@821 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smccTest/src/test/java/at/gv/egiz/pkcs15test/TLVSequence.java')
-rw-r--r--smccTest/src/test/java/at/gv/egiz/pkcs15test/TLVSequence.java81
1 files changed, 0 insertions, 81 deletions
diff --git a/smccTest/src/test/java/at/gv/egiz/pkcs15test/TLVSequence.java b/smccTest/src/test/java/at/gv/egiz/pkcs15test/TLVSequence.java
deleted file mode 100644
index fcfc22e5..00000000
--- a/smccTest/src/test/java/at/gv/egiz/pkcs15test/TLVSequence.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package at.gv.egiz.pkcs15test;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/*
- * Copyright 2009 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class TLVSequence implements Iterable<TLV> {
-
- private byte[] bytes;
-
- public TLVSequence(byte[] bytes) {
- this.bytes = bytes;
- }
-
- @Override
- public Iterator<TLV> iterator() {
- return new TLVIterator();
- }
-
- public byte[] getValue(int tag) {
- for (TLV tlv : this) {
- if (tlv.getTag() == tag) {
- return tlv.getValue();
- }
- }
- return null;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- for (TLV tlv : this) {
- sb.append(tlv).append('\n');
- }
- return sb.toString();
- }
-
- private class TLVIterator implements Iterator<TLV> {
-
- private int pos = 0;
-
- @Override
- public boolean hasNext() {
- return (bytes.length - pos > 2);
- }
-
- @Override
- public TLV next() {
- if (hasNext()) {
- TLV tlv = new TLV(bytes, pos);
- pos += tlv.getLength() + 2;
- return tlv;
- } else {
- throw new NoSuchElementException();
- }
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- }
-
-}