public class IOUtility extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BUFSIZ |
static Charset |
CS_ISO8859_1 |
static Charset |
CS_MS932 |
static Charset |
CS_UTF8 |
| Constructor and Description |
|---|
IOUtility() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
bufferToByteArray(CharSequence cseq)
CharSequenceの内容をByteArrayに変換します.
|
static void |
bufferToFile(File file,
CharSequence cseq)
CharSequenceの内容を指定ファイルに書き込みます.
|
static void |
bufferToFile(File file,
Charset cset,
CharSequence cseq)
CharSequenceの内容を指定ファイルに書き込みます.
|
static StringBuffer |
byteArrayToBuffer(byte[] ba)
ByteArrayの内容をStringBufferに変換します.
|
static void |
byteArrayToFile(File file,
byte[] ba)
ByteArrayの内容を指定ファイルに書き込みます.
|
static StringBuffer |
fileToBuffer(File file)
指定ファイルを読み込み,StringBufferに入れて返します.
|
static byte[] |
fileToByteArray(File file)
指定ファイルを読み込み,ByteArrayに入れて返します.
|
static byte[] |
inputStreamToByteArray(InputStream in)
InputStreamからデータを読み込み,ByteArrayに入れて返します.
|
static PrintWriter |
openPrintWriter(File file)
文字エンコーディング UTF-8 で指定ファイルのPrintWriterを開きます.
|
static PrintWriter |
openPrintWriter(File file,
Charset cset)
指定のファイルのPrintWriterを開きます.
|
static PrintWriter |
openPrintWriter(File file,
String enc)
指定のファイルのPrintWriterを開きます.
|
static Reader |
openReader(byte[] ba)
文字エンコーディング UTF-8 で指定ByteArrayのReaderを開きます.
|
static Reader |
openReader(byte[] ba,
Charset cset)
指定のByteArrayのReaderを開きます.
|
static Reader |
openReader(byte[] ba,
String enc)
指定のByteArrayのReaderを開きます.
|
static Reader |
openReader(File file)
文字エンコーディング UTF-8 で指定ファイルのReaderを開きます.
|
static Reader |
openReader(File file,
Charset cset)
指定のファイルのReaderを開きます.
|
static Reader |
openReader(File file,
String enc)
指定のファイルのReaderを開きます.
|
static Reader |
openReader(URL url)
文字エンコーディング UTF-8 で指定URLのReaderを開きます.
|
static Reader |
openReader(URL url,
Charset cset)
指定のURLのReaderを開きます.
|
static Reader |
openReader(URL url,
String enc)
指定のURLのReaderを開きます.
|
static Writer |
openWriter(File file)
文字エンコーディング UTF-8 で指定ファイルのWriterを開きます.
|
static Writer |
openWriter(File file,
Charset cset)
指定のファイルのWriterを開きます.
|
static Writer |
openWriter(File file,
String enc)
指定のファイルのWriterを開きます.
|
public static final Charset CS_UTF8
public static final Charset CS_ISO8859_1
public static final Charset CS_MS932
public static final int BUFSIZ
public static Writer openWriter(File file, String enc) throws FileNotFoundException, SecurityException, UnsupportedEncodingException
file - ファイルオブジェクトenc - 文字エンコーディングWriter オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.UnsupportedEncodingException - 文字のコーディングがサポートされていない場合.public static Writer openWriter(File file, Charset cset) throws FileNotFoundException, SecurityException
file - ファイルオブジェクトcset - 文字セットWriter オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.public static Writer openWriter(File file) throws FileNotFoundException, SecurityException
file - ファイルオブジェクトWriter オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.public static PrintWriter openPrintWriter(File file, String enc) throws FileNotFoundException, SecurityException, UnsupportedEncodingException
file - ファイルオブジェクトenc - 文字エンコーディングPrintWriter オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.UnsupportedEncodingException - 文字のコーディングがサポートされていない場合.public static PrintWriter openPrintWriter(File file, Charset cset) throws FileNotFoundException, SecurityException
file - ファイルオブジェクトcset - 文字セットPrintWriter オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.public static PrintWriter openPrintWriter(File file) throws FileNotFoundException, SecurityException
file - ファイルオブジェクトPrintWriter オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.public static Reader openReader(byte[] ba, String enc) throws UnsupportedEncodingException
ba - ByteArrayオブジェクトenc - 文字エンコーディングReader オブジェクトを返します.UnsupportedEncodingException - 文字のコーディングがサポートされていない場合.public static Reader openReader(byte[] ba, Charset cset)
ba - ByteArrayオブジェクトcset - 文字セットReader オブジェクトを返します.public static Reader openReader(byte[] ba)
ba - ByteArrayオブジェクトReader オブジェクトを返します.public static Reader openReader(File file, String enc) throws FileNotFoundException, SecurityException, UnsupportedEncodingException
file - ファイルオブジェクトenc - 文字エンコーディングReader オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.UnsupportedEncodingException - 文字のコーディングがサポートされていない場合.public static Reader openReader(File file, Charset cset) throws FileNotFoundException, SecurityException
file - ファイルオブジェクトcset - 文字セットReader オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.public static Reader openReader(File file) throws FileNotFoundException, SecurityException
file - ファイルオブジェクトReader オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.public static Reader openReader(URL url, String enc) throws IOException, SecurityException, UnsupportedEncodingException
url - URLオブジェクトenc - 文字エンコーディングReader オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.UnsupportedEncodingException - 文字のコーディングがサポートされていない場合.IOExceptionpublic static Reader openReader(URL url, Charset cset) throws IOException, SecurityException
url - URLオブジェクトcset - 文字セットReader オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.IOExceptionpublic static Reader openReader(URL url) throws IOException, SecurityException
url - URLオブジェクトReader オブジェクトを返します.FileNotFoundException - 指定されたファイルがオープンできなかった場合.SecurityException - セキュリティ・マネージャが存在し,アクセスが拒否された場合.IOExceptionpublic static StringBuffer fileToBuffer(File file) throws IOException
file - FileオブジェクトIOException - 入出力エラーが発生した場合.public static void bufferToFile(File file, CharSequence cseq) throws IOException
file - Fileオブジェクトcseq - CharSequenceオブジェクトIOException - 入出力エラーが発生した場合.public static void bufferToFile(File file, Charset cset, CharSequence cseq) throws IOException
file - Fileオブジェクトcset - 文字セットcseq - CharSequenceオブジェクトIOException - 入出力エラーが発生した場合.public static byte[] fileToByteArray(File file) throws IOException
file - FileオブジェクトIOException - 入出力エラーが発生した場合.public static byte[] inputStreamToByteArray(InputStream in) throws IOException
in - InputStreamIOException - 入出力エラーが発生した場合.public static void byteArrayToFile(File file, byte[] ba) throws IOException
file - Fileオブジェクトba - byte[]オブジェクトIOException - 入出力エラーが発生した場合.public static StringBuffer byteArrayToBuffer(byte[] ba)
ba - byte[]オブジェクトpublic static byte[] bufferToByteArray(CharSequence cseq)
cseq - CharSequenceオブジェクトEDB Working Group at Mon Dec 15 16:45:05 JST 2025