net.argius.stu
クラス IOManager

java.lang.Object
  拡張net.argius.stu.IOManager
直系の既知のサブクラス:
DefaultIOManager

public abstract class IOManager
extends Object

入出力システムの基底クラスです。 このアプリケーションが使用する入出力インターフェイスを管理します。 それぞれ、入力機能を「スキャナ」、出力機能を「プリンタ」と呼びます。 アプリケーションでは、1つのスキャナと2つのプリンタ(出力とエラー出力)を 使用するため、これらを保持します。

関連項目:
Scanner, Printer

コンストラクタの概要
IOManager()
           
 
メソッドの概要
 void close()
          入出力マネージャを閉じます。
protected  Application getApplication()
          アプリケーションオブジェクトを取得します。
protected  Printer getErrorPrinter()
          エラープリンタを取得します。
static String getLineSeparator()
          改行文字を取得します。
protected  Printer getOutputPrinter()
          出力プリンタを取得します。
protected  Scanner getScanner()
          スキャナを取得します。
abstract  void printMessage(String message, boolean newLine)
          この入出力マネージャの出力にメッセージを送出します。
abstract  String scanLine()
          この入出力マネージャの入力から文字列を1行読み取ります。
protected  void setApplication(Application newApp)
          アプリケーションオブジェクトを設定します。
protected  void setErrorPrinter(Printer err)
          エラープリンタを設定します。
protected  void setOutputPrinter(Printer out)
          出力プリンタを設定します。
protected  void setScanner(Scanner in)
          スキャナを設定します。
abstract  int showResult(ResultSet rs, int limit)
          この入出力マネージャの出力に実行結果を送出します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

IOManager

public IOManager()
メソッドの詳細

scanLine

public abstract String scanLine()
                         throws IOException
この入出力マネージャの入力から文字列を1行読み取ります。 どこからどのように入力されるかは、この入出力マネージャに任されます。

戻り値:
入力された文字列
例外:
IOException - 入出力エラー

showResult

public abstract int showResult(ResultSet rs,
                               int limit)
                        throws IOException,
                               SQLException
この入出力マネージャの出力に実行結果を送出します。 結果がどのように表示されるかは、この入出力マネージャに任されます。

パラメータ:
rs - 結果セット
limit - 最大表示件数 0以下は無制限
戻り値:
結果件数
例外:
IOException - 入出力エラー
SQLException - データベースアクセスエラー

printMessage

public abstract void printMessage(String message,
                                  boolean newLine)
                           throws IOException
この入出力マネージャの出力にメッセージを送出します。 メッセージがどのように表示されるかは、この入出力マネージャに任されます。

パラメータ:
message - メッセージ文字列
newLine - 改行する場合はtrue、しない場合はfalse
例外:
IOException - 入出力エラー

close

public void close()
入出力マネージャを閉じます。


getLineSeparator

public static final String getLineSeparator()
改行文字を取得します。

戻り値:
改行文字

getScanner

protected final Scanner getScanner()
スキャナを取得します。

戻り値:
スキャナ

setScanner

protected void setScanner(Scanner in)
スキャナを設定します。

パラメータ:
in - スキャナ

getOutputPrinter

protected final Printer getOutputPrinter()
出力プリンタを取得します。

戻り値:
出力プリンタ

setOutputPrinter

protected void setOutputPrinter(Printer out)
出力プリンタを設定します。

パラメータ:
out - 出力プリンタ

getErrorPrinter

protected final Printer getErrorPrinter()
エラープリンタを取得します。

戻り値:
エラープリンタ

setErrorPrinter

protected void setErrorPrinter(Printer err)
エラープリンタを設定します。

パラメータ:
err - エラープリンタ

getApplication

protected final Application getApplication()
アプリケーションオブジェクトを取得します。

戻り値:
アプリケーションオブジェクト

setApplication

protected final void setApplication(Application newApp)
アプリケーションオブジェクトを設定します。

パラメータ:
newApp - アプリケーションオブジェクト