net.aerith.misao.io
Class Encoder
java.lang.Object
|
+--net.aerith.misao.io.Encoder
- public class Encoder
- extends java.lang.Object
The Encoder
is a class to encode a file in some
compression or cryption. In general, it zips the file
automatically when the file name ends with .gz.
Method Summary |
private static void |
mkdir(java.io.File file)
Creates a directory to create the file to output. |
static java.io.DataOutputStream |
newOutputStream(java.io.File file)
Creates a new output stream. |
private static java.io.OutputStream |
newOutputStream(java.lang.String name,
java.io.OutputStream stream)
Creates a new output stream. |
static java.io.DataOutputStream |
newOutputStream(java.net.URL url)
Creates a new output stream. |
static java.io.PrintWriter |
newWriter(java.io.File file)
Creates a new writer. |
static java.io.PrintWriter |
newWriter(java.net.URL url)
Creates a new writer. |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
Encoder
public Encoder()
newOutputStream
public static final java.io.DataOutputStream newOutputStream(java.io.File file)
throws java.io.IOException
- Creates a new output stream. When the file name ends with .gz,
it automatically zips.
- Parameters:
file
- the file.- Returns:
- the output stream.
- Throws:
- java.io.IOException - if a file cannot be accessed.
newOutputStream
public static final java.io.DataOutputStream newOutputStream(java.net.URL url)
throws java.io.IOException
- Creates a new output stream. When the file name ends with .gz,
it automatically zips.
- Parameters:
url
- the URL.- Returns:
- the output stream.
- Throws:
- java.io.IOException - if a file cannot be accessed.
newWriter
public static final java.io.PrintWriter newWriter(java.io.File file)
throws java.io.IOException
- Creates a new writer. When the file name ends with .gz, it
automatically zips.
- Parameters:
file
- the file.- Returns:
- the writer.
- Throws:
- java.io.IOException - if a file cannot be accessed.
newWriter
public static final java.io.PrintWriter newWriter(java.net.URL url)
throws java.io.IOException
- Creates a new writer. When the file name ends with .gz, it
automatically zips.
- Parameters:
url
- the URL.- Returns:
- the writer.
- Throws:
- java.io.IOException - if a file cannot be accessed.
mkdir
private static final void mkdir(java.io.File file)
throws java.io.IOException
- Creates a directory to create the file to output.
- Parameters:
file
- the file to output.- Throws:
- java.io.IOException - if a file cannot be accessed.
newOutputStream
private static final java.io.OutputStream newOutputStream(java.lang.String name,
java.io.OutputStream stream)
throws java.io.IOException
- Creates a new output stream. When the file name ends with .gz,
it automatically zips.
- Parameters:
name
- the name of the file or URL.stream
- the primitive output stream.- Returns:
- the output stream.
- Throws:
- java.io.IOException - if a file cannot be accessed.