📄 dxexception.java
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: DxException.java,v 1.6 2000/10/28 16:55:14 daniela Exp $package org.ozoneDB.DxLib;import java.lang.reflect.*;import java.io.*;/** * Diese Klasse dient dazu, ein Java-Exception in einem Stream zu schreiben * bzw. daraus zu lesen. Das ist z.B. fuer Socket-Verbindungen nuetzlich. * * * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.6 $Date: 2000/10/28 16:55:14 $ */public class DxException extends DxObject implements Externalizable { final static long serialVersionUID = 1L; Throwable exc; String msg; public DxException() { msg = new String(); } public DxException( Throwable e ) { exc = e; msg = new String( e.toString() ); } public Throwable toExc() { return exc; } public String toString() { return msg; } public void writeExternal( ObjectOutput out ) throws IOException { try { if (exc != null) { out.writeUTF( exc.getClass().getName() ); } else { out.writeUTF( "null" ); } out.writeUTF( msg ); } catch (Exception e) { throw new IOException( e.toString() ); } } public void readExternal( ObjectInput in ) throws IOException { try { String e = in.readUTF(); msg = in.readUTF(); if (e.compareTo( "null" ) != 0) { Class[] classes = new Class[1]; classes[0] = e.getClass(); Constructor constr = Class.forName( e ).getConstructor( classes ); if (constr != null) { Object[] args = new Object[1]; args[0] = msg; System.out.println( args[0] ); exc = (Throwable)constr.newInstance( args ); } } } catch (Exception e) { throw new IOException( e.toString() ); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -