public class PhantomOutputFile extends Object
| Modifier and Type | Field and Description |
|---|---|
static byte[] | isoNewLineThe New Line separator bytes for ISO character encoding. |
static String | newLineThe New Line separator. |
| Constructor and Description |
|---|
PhantomOutputFile()Creates a in-memory byte array output stream where the contents can be retrieved by means of getByteArrayOutputStream() or getByteArray() methods. |
PhantomOutputFile(File file)Creates the specified file for write. |
PhantomOutputFile(OutputStream out)Creates an instance for the output stream. |
PhantomOutputFile(String fileName)Creates the specified file for write. |
PhantomOutputFile(String fileName, PhantomFile openFile)Creates the specified file for write. |
PhantomOutputFile(String fileName, String previousFile)Creates the specified file for write. |
| Modifier and Type | Method and Description |
|---|---|
void | close()Close stream and file |
byte[] | getByteArray()Gets the written data as a byte array when the file refers to an in-memory file. |
ByteArrayOutputStream | getByteArrayOutputStream()Gets the byte array output stream instance. |
DataOutputStream | getDataOutputStream()Gets the data output stream instance. |
FileOutputStream | getFileOutputStream()Gets the file output stream instance. |
OutputStream | getOutputStream()Gets the file output stream instance. |
boolean | isNetPhantom5File()Checks if the file is used to write data for NetPhantom 5 or not. |
void | setCodePages(String ansiCP, String oemCP)Sets the Ansi and OEM code pages. |
void | setNetPhantom5(boolean isNetPhantom5)Sets the NetPhantom 5 flag. |
void | writeAnsiString(String s)Writes a string to its length using the Ansi character set. |
void | writeAnsiStringNullTerminated(String s, int length)Writes an Ansi string padded to the specified length with the zero padding character. |
void | writeAnsiStringPadded(String s, int length, char pad)Writes an Ansi string padded to the specified length with the padding character. |
void | writeAnsiStrings(Collection<String> strings)Converts an array of unicode strings to Ansi bytes and writes them to file using environment dependent line separator. |
void | writeBoolean(boolean b)Write a number of zero'ed bytes. |
void | writeByte(byte d)Write a byte to the file. |
void | writeByte(int d)Write a byte to the file. |
void | writeBytes(byte[] d)Write a byte array to the file. |
void | writeBytes(byte[] d, int offset, int length)Write a byte array to the file. |
void | writeIntelDouble(double value)Writes a double value from the file. |
void | writeIntelLong(int v)Writes an Intel formatted Long (32 bit value). |
void | writeIntelShort(int v)Writes an Intel formatted Short (16 bit signed value). |
void | writeIntelUShort(int v)Writes an Intel formatted UShort (16 bit unsigned value). |
void | writeISOLine(String line)Writes a string as a line in a file encoded in ISO 8859-1 character set. |
void | writeLine(byte[] line)Writes an array of bytes to file and append line separator. |
void | writeOEMString(String s)Writes a string to its length using the OEM (ASCII) character set. |
void | writeOEMStringNullTerminated(String s, int length)Writes an OEM string padded to the specified length with the zero padding character. |
void | writeOEMStringPadded(String s, int length, char pad)Writes a string padded to the specified length with the padding character. |
void | writeOEMStrings(Collection<String> strings)Converts an array of unicode strings to ASCII bytes and writes them to file using environment dependent line separator. |
void | writeUnicodeString(String s)Writes a string to its length using the OEM (ASCII) character set. |
void | writeUnicodeStringPadded(String s, int length, char pad)Writes a string padded to the specified length with the padding character. |
void | writeZeroedBytes(int cc)Write a number of zero'ed bytes. |
public static final String newLine
public static final byte[] isoNewLine
public PhantomOutputFile(File file) throws IOException
IOException - if an I/O error occurs.public PhantomOutputFile(String fileName) throws IOException
IOException - if an I/O error occurs.public PhantomOutputFile(String fileName, PhantomFile openFile) throws IOException
IOException - if an I/O error occurs.public PhantomOutputFile(String fileName, String previousFile) throws IOException
IOException - if an I/O error occurs.public PhantomOutputFile(OutputStream out)
public PhantomOutputFile()
public void setCodePages(String ansiCP, String oemCP) throws IOException
ansiCP - The Ansi codepage, null for default.oemCP - The OEM codepage, null for default.IOException - For file errors or codepage does not exist (file is closed).public void setNetPhantom5(boolean isNetPhantom5)
isNetPhantom5 - Flag for NetPhantom 5 file.public boolean isNetPhantom5File()
public void close()
throws IOExceptionIOException - if an I/O error occurs.public DataOutputStream getDataOutputStream()
public FileOutputStream getFileOutputStream()
public ByteArrayOutputStream getByteArrayOutputStream()
public OutputStream getOutputStream()
public byte[] getByteArray()
public void writeBytes(byte[] d)
throws IOExceptionIOException - if an I/O error occurs.public void writeBytes(byte[] d,
int offset,
int length)
throws IOExceptionIOException - if an I/O error occurs.public void writeByte(byte d)
throws IOExceptionIOException - if an I/O error occurs.public void writeByte(int d)
throws IOExceptionIOException - if an I/O error occurs.public void writeZeroedBytes(int cc)
throws IOExceptionIOExceptionpublic void writeBoolean(boolean b)
throws IOExceptionIOExceptionpublic void writeIntelLong(int v)
throws IOExceptionIOException - if an I/O error occurs.public void writeIntelShort(int v)
throws IOExceptionIOException - if an I/O error occurs.public void writeIntelUShort(int v)
throws IOExceptionIOException - if an I/O error occurs.public void writeIntelDouble(double value)
throws IOExceptionvalue -IOException - if an I/O error occurs.public void writeLine(byte[] line)
throws IOExceptionIOException - if an I/O error occurs.public void writeISOLine(String line) throws IOException
Typically, this function is used to write data that is then read with PhantomFile.readISOLine.
IOException - if an I/O error occurs.PhantomFile.readISOLine()public void writeUnicodeString(String s) throws IOException
IOException - if an I/O error occurs.public void writeUnicodeStringPadded(String s, int length, char pad) throws IOException
IOException - if an I/O error occurs.public void writeOEMStrings(Collection<String> strings) throws IOException
IOException - if an I/O error occurs.public void writeAnsiStrings(Collection<String> strings) throws IOException
IOException - if an I/O error occurs.public void writeOEMString(String s) throws IOException
IOException - if an I/O error occurs.public void writeAnsiString(String s) throws IOException
IOException - if an I/O error occurs.public void writeOEMStringPadded(String s, int length, char pad) throws IOException
IOException - if an I/O error occurs.public void writeAnsiStringPadded(String s, int length, char pad) throws IOException
IOException - if an I/O error occurs.public void writeOEMStringNullTerminated(String s, int length) throws IOException
IOException - if an I/O error occurs.public void writeAnsiStringNullTerminated(String s, int length) throws IOException
IOException - if an I/O error occurs.Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© 2026 Mindus SARL. All rights reserved.