modelexception.java
来自「<j2me 开发精解> 詹建光著 里所有的源码。对J2me的开发相当」· Java 代码 · 共 62 行
JAVA
62 行
/* * ModelException.java * * Created on 2005年9月11日, 下午8:07 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package com.ch6.post;import java.io.DataInputStream;import java.io.DataOutputStream;import java.io.IOException;/** * * @author Administrator */public class ModelException extends Exception { public static final byte CAUSE_GENERAL = 0; public static final byte CAUSE_USER_NOT_FOUND = 1; public static final byte CAUSE_INCORRECT_PASSWORD = 2; private int causeCode = CAUSE_GENERAL; public ModelException(int causeCode) { this.causeCode = causeCode; return; } public int getCauseCode() { return causeCode; } public void serialize(DataOutputStream dataStream) throws ApplicationException { try { dataStream.writeInt(causeCode); return; } catch (IOException ioe) { throw new ApplicationException(ioe); } } public static ModelException deserialize(DataInputStream dataStream) throws ApplicationException { try { return new ModelException(dataStream.readInt()); } catch (IOException ioe) { throw new ApplicationException(ioe); } } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?