| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.protocols.asn1; |
| | | |
| | |
| | | import java.io.IOException; |
| | | import java.net.Socket; |
| | | |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.ProtocolMessages.*; |
| | | |
| | |
| | | */ |
| | | public class ASN1Reader |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.protocols.asn1.ASN1Reader"; |
| | | |
| | | |
| | | |
| | |
| | | public ASN1Reader(Socket socket) |
| | | throws IOException |
| | | { |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(socket)); |
| | | |
| | | this.socket = socket; |
| | | inputStream = socket.getInputStream(); |
| | |
| | | */ |
| | | public ASN1Reader(InputStream inputStream) |
| | | { |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(inputStream)); |
| | | |
| | | this.inputStream = inputStream; |
| | | socket = null; |
| | |
| | | */ |
| | | public int getMaxElementSize() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getMaxElementSize"); |
| | | |
| | | return maxElementSize; |
| | | } |
| | |
| | | */ |
| | | public void setMaxElementSize(int maxElementSize) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setMaxElementSize", |
| | | String.valueOf(maxElementSize)); |
| | | |
| | | this.maxElementSize = maxElementSize; |
| | | } |
| | |
| | | public int getIOTimeout() |
| | | throws IOException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getIOTimeout"); |
| | | |
| | | if (socket == null) |
| | | { |
| | |
| | | public void setIOTimeout(int ioTimeout) |
| | | throws IOException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setIOTimeout", String.valueOf(ioTimeout)); |
| | | |
| | | if (socket == null) |
| | | { |
| | |
| | | */ |
| | | public void close() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "close"); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "close", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | |
| | | if (socket != null) |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "close", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |