📄 escapequotewriter.java
字号:
/**
* IgaLib -> String
* Copyright (C) 2001 Tosiki IGA , IgaLib project member
* (http://homepage2.nifty.com/igat/igapyon/index.html)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package jp.ne.nifty.iga.tosiki.string;
import java.io.*;
/**
* 僟僽儖僋僆乕僥乕僔儑儞偍傛傃僄僗働乕僾暥帤帺恎傪僄僗働乕僾偡傞僋儔僗<BR>
* 僜乕僗僐乕僪傪Writer弌椡偡傞嵺偵丄僟僽儖僋僆乕僥乕僔儑儞偍傛傃僄僗働乕僾暥帤帺恎
* 偼僄僗働乕僾偡傞昁梫偑偁傝傑偡丅
* 偙偺僋儔僗偼偦偺傛偆側僄僗働乕僾傪幚尰偡傞Writer僋儔僗偱偡丅<BR>
*
* @author Tosiki IGA
*/
public class EscapeQuoteWriter
extends Writer
{
protected Writer writer=null;
/**
* 僟僽儖僋僆乕僥乕僔儑儞傪僄僗働乕僾偡傞Writer僋儔僗偺僐儞僗僩儔僋僞
*
* @param Writer writer 楢寢偡傞尦偺Writer
*/
public EscapeQuoteWriter(Writer writer)
{
this.writer=writer;
}
/**
* 1暥帤Writer偵彂偒崬傒傑偡丅
*
* @param int cWrite 彂偒崬傓暥帤
* @throws IOException 壗偐偟傜偺I/O椺奜
*/
public void write(int cWrite)
throws IOException
{
if(cWrite=='"'
|| cWrite=='\\')
{
writer.write('\\');
}
writer.write(cWrite);
}
/**
* 暥帤攝楍傪Writer傊彂偒崬傒傑偡丅<BR>
* 偨偩偟彂偒崬傑傟傞偺偼 梌偊傜傟偨暥帤楍偺16恑壔僟儞僾暥帤楍偱偡
*
* @param char cbuf[] 彂偒崬傒僶僢僼傽
* @param int off 彂偒崬傒僶僢僼傽偺僆僼僙僢僩
* @param int len 彂偒崬傒挿偝
* @throws IOException 壗偐偟傜偺I/O椺奜
*/
public final void write(char cbuf[], int off, int len)
throws IOException
{
int iTill=off+len;
for(int index=off;index<iTill;index++)
{
write(cbuf[index]);
}
}
/**
* Writer傪僼儔僢僔儏偟傑偡
*
* @throws IOException 壗偐偟傜偺I/O椺奜偺敪惗
*/
public final void flush()
throws IOException
{
if(writer!=null)
{
writer.flush();
}
}
/**
* Writer傪僋儘乕僘偟傑偡
*
* @throws IOException 壗偐偟傜偺I/O椺奜偺敪惗
*/
public final void close()
throws IOException
{
if(writer!=null)
{
writer.close();
writer=null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -