Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moex
Transmorpher
Commits
90e2a60d
Commit
90e2a60d
authored
May 24, 2002
by
SAINT-MARCEL Frederic
Browse files
add readwrite
parent
43a172f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
flowcomposer/src/fr/fluxmedia/flowcomposer/Parser.java
0 → 100644
View file @
90e2a60d
/*
* Created by IntelliJ IDEA.
* User: administrateur
* Date: 22 mai 2002
* Time: 15:49:04
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package
fr.fluxmedia.flowcomposer
;
// Imported SAX Classes
import
org.xml.sax.Attributes
;
import
org.xml.sax.helpers.DefaultHandler
;
import
org.xml.sax.SAXException
;
import
org.xml.sax.SAXParseException
;
import
org.xml.sax.helpers.XMLFilterImpl
;
//Imported JAVA Classes
import
java.io.*
;
import
java.util.Stack
;
public
class
Parser
extends
DefaultHandler
{
/** The XML Parser class */
private
static
final
String
DEFAULT_PARSER_NAME
=
"org.apache.xerces.parsers.SAXParser"
;
/** XML Parser */
javax
.
xml
.
parsers
.
SAXParser
iParser
=
null
;
/*------------------------------------------ CONSTRUCTOR -----------------------------*/
/** The constructor, build the XML Parser but not parse the document */
public
Parser
()
{
try
{
javax
.
xml
.
parsers
.
SAXParserFactory
iParserFactory
=
javax
.
xml
.
parsers
.
SAXParserFactory
.
newInstance
();
iParserFactory
.
setValidating
(
true
);
iParserFactory
.
setNamespaceAware
(
true
);
iParser
=
iParserFactory
.
newSAXParser
();
}
catch
(
javax
.
xml
.
parsers
.
ParserConfigurationException
CNFE
)
{
System
.
out
.
println
(
"FMParser :Error ["
+
CNFE
+
"]"
);
}
catch
(
org
.
xml
.
sax
.
SAXException
SaxE
)
{
System
.
out
.
println
(
"FMParser :Error ["
+
SaxE
+
"]"
);
}
}
/*------------------------------------------- END CONSTRUCTOR ------------------------*/
/** Parse the document given in parameter */
public
void
newParse
(
String
uri
)
{
try
{
iParser
.
parse
(
uri
,
this
);
}
catch
(
SAXException
SE
)
{
System
.
err
.
println
(
"[FMParser]Erreur SAX("
+
SE
+
")"
);
System
.
err
.
println
(
"[FMParser]Erreur SAX("
+
SE
.
getMessage
()+
")"
);
System
.
err
.
println
(
"[FMParser]Erreur SAX("
+
SE
.
getException
()+
")"
);
SE
.
printStackTrace
();
}
catch
(
java
.
io
.
IOException
IOE
)
{
System
.
err
.
println
(
"[FMParser]Erreur IO("
+
IOE
+
")"
);
}
}
public
void
warning
(
SAXParseException
exception
)
throws
SAXException
{
System
.
err
.
println
(
"warning"
);
}
public
void
error
(
SAXParseException
ex
)
{
System
.
err
.
print
(
"Error!! "
);
System
.
err
.
println
(
ex
);
}
public
void
fatalError
(
SAXParseException
ex
)
throws
SAXException
{
System
.
err
.
print
(
"Fatal Error!! "
);
System
.
err
.
println
(
ex
);
}
}
flowcomposer/src/fr/fluxmedia/flowcomposer/ReadWrite.java
0 → 100644
View file @
90e2a60d
/*
* Created by IntelliJ IDEA.
* User: administrateur
* Date: 22 mai 2002
* Time: 17:08:31
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package
fr.fluxmedia.flowcomposer
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.FileReader
;
public
class
ReadWrite
{
public
static
final
int
READ
=
0
;
public
static
final
int
WRITE
=
1
;
FileWriter
vFileW
=
null
;
FileReader
vFileR
=
null
;
String
vFileName
=
null
;
int
vMode
=
0
;
public
ReadWrite
(
String
pName
,
int
pMode
)
{
vFileName
=
pName
;
vMode
=
pMode
;
try
{
if
(
pMode
==
WRITE
)
{
vFileW
=
new
FileWriter
(
pName
);
}
else
{
vFileR
=
new
FileReader
(
pName
);
}
}
catch
(
java
.
io
.
IOException
pE
)
{
if
(
pMode
==
WRITE
)
{
System
.
err
.
println
(
"[Save] "
+
pE
);
}
else
{
System
.
err
.
println
(
"[Load] "
+
pE
);
}
}
}
public
String
getName
()
{
return
vFileName
;
}
public
void
Write
(
String
pString
)
{
try
{
//System.err.print("[" +vFileName +"] : " +pString);
vFileW
.
write
(
pString
);
}
catch
(
java
.
io
.
IOException
pE
)
{
System
.
err
.
println
(
"[Save] "
+
pE
);
}
}
public
void
Write
(
int
Decalage
,
String
pString
)
{
String
vParam
=
""
;
for
(
int
i
=
0
;
i
<
Decalage
;
i
++)
{
vParam
+=
" "
;
}
Write
(
vParam
+
pString
);
}
public
void
Writeln
(
int
Decalage
,
String
pString
)
{
String
vParam
=
""
;
for
(
int
i
=
0
;
i
<
Decalage
;
i
++)
{
vParam
+=
" "
;
}
Writeln
(
vParam
+
pString
);
}
public
void
Writeln
(
String
pString
)
{
try
{
//System.err.println("[" +vFileName +"] : " +pString+"\n");
vFileW
.
write
(
pString
+
"\n"
);
}
catch
(
java
.
io
.
IOException
pE
)
{
System
.
err
.
println
(
"[Save] "
+
pE
);
}
}
public
void
Writeln
()
{
try
{
vFileW
.
write
(
"\n"
);
}
catch
(
java
.
io
.
IOException
pE
)
{
System
.
err
.
println
(
"[Save] "
+
pE
);
}
}
public
char
[]
Read
()
{
char
[]
chaine
=
null
;
try
{
int
Taillefichier
=
(
int
)
(
new
File
(
vFileName
).
length
());
chaine
=
new
char
[
Taillefichier
];
int
longueur
=
vFileR
.
read
(
chaine
);
}
catch
(
java
.
io
.
IOException
pE
)
{
System
.
err
.
println
(
"[Load] "
+
pE
);
}
return
chaine
;
}
public
void
Close
()
{
try
{
if
(
vMode
==
READ
)
vFileR
.
close
();
else
vFileW
.
close
();
}
catch
(
java
.
io
.
IOException
pE
)
{
System
.
err
.
println
(
"[Save] "
+
pE
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment