From 22094368c2865dcfb6daf8366425212b721a4657 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Thu, 05 Feb 2009 17:42:14 +0000
Subject: [PATCH] Merge ASN1 branch to trunk

---
 opends/src/server/org/opends/server/plugins/profiler/ProfilerThread.java |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/opends/src/server/org/opends/server/plugins/profiler/ProfilerThread.java b/opends/src/server/org/opends/server/plugins/profiler/ProfilerThread.java
index 3f0fc55..9d03d62 100644
--- a/opends/src/server/org/opends/server/plugins/profiler/ProfilerThread.java
+++ b/opends/src/server/org/opends/server/plugins/profiler/ProfilerThread.java
@@ -30,15 +30,11 @@
 
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
 import org.opends.server.api.DirectoryThread;
-import org.opends.server.protocols.asn1.ASN1Element;
-import org.opends.server.protocols.asn1.ASN1Long;
-import org.opends.server.protocols.asn1.ASN1Sequence;
-import org.opends.server.protocols.asn1.ASN1Writer;
+import org.opends.server.protocols.asn1.*;
 
 import static org.opends.server.loggers.debug.DebugLogger.*;
 import org.opends.server.loggers.debug.DebugTracer;
@@ -233,7 +229,7 @@
   {
     // Open the capture file for writing.  We'll use an ASN.1 writer to write
     // the data.
-    ASN1Writer writer = new ASN1Writer(new FileOutputStream(filename));
+    ASN1Writer writer = ASN1.getWriter(new FileOutputStream(filename));
 
 
     try
@@ -251,19 +247,19 @@
 
       // Write a header to the file containing the number of samples and the
       // start and stop times.
-      ArrayList<ASN1Element> headerElements = new ArrayList<ASN1Element>(3);
-      headerElements.add(new ASN1Long(numIntervals));
-      headerElements.add(new ASN1Long(captureStartTime));
-      headerElements.add(new ASN1Long(captureStopTime));
-      writer.writeElement(new ASN1Sequence(headerElements));
+      writer.writeStartSequence();
+      writer.writeInteger(numIntervals);
+      writer.writeInteger(captureStartTime);
+      writer.writeInteger(captureStopTime);
+      writer.writeEndSequence();
 
 
       // For each unique stack captured, write it to the file followed by the
       // number of occurrences.
       for (ProfileStack s : stackTraces.keySet())
       {
-        writer.writeElement(s.encode());
-        writer.writeElement(new ASN1Long(stackTraces.get(s)));
+        s.write(writer);
+        writer.writeInteger(stackTraces.get(s));
       }
     }
     finally

--
Gitblit v1.10.0