本文整理汇总了Python中java.io.PrintWriter.close方法的典型用法代码示例。如果您正苦于以下问题:Python PrintWriter.close方法的具体用法?Python PrintWriter.close怎么用?Python PrintWriter.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.PrintWriter
的用法示例。
在下文中一共展示了PrintWriter.close方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rtl_dump_svg
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import close [as 别名]
def rtl_dump_svg(dmuid,filename):
rtlmanager = project.getRTLM()
uid = DMUID.parse(dmuid)
rtlm = rtlmanager.findModule(Toplevel(uid, None))
if rtlm == None:
printf('RTLM %s not found', dmuid)
else:
printf('Dumping %s...', rtlm)
out = PrintWriter(BufferedWriter(FileWriter(filename)))
gc = VGGCSVG(out)
contentProvider = RTLVisualGraphContentProvider(rtlm)
labelProvider = RTLVisualGraphLabelProvider(rtlm)
selectionProvider = RTLVisualGraphSelectionProvider()
layout = VGLayout(contentProvider, labelProvider, gc)
layout.paint(selectionProvider);
out.close()
printf("python: wrote svg file to %s", filename)
示例2: testCSVPipe
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import close [as 别名]
def testCSVPipe(self):
"""testing the CSV pipe"""
from java.io import PrintWriter, FileWriter
from com.ziclix.python.sql.pipe import Pipe
from com.ziclix.python.sql.pipe.db import DBSource
from com.ziclix.python.sql.pipe.csv import CSVSink
try:
src = self.connect()
fn = tempfile.mktemp(suffix="csv")
writer = PrintWriter(FileWriter(fn))
csvSink = CSVSink(writer)
c = self.cursor()
try:
c.execute("insert into zxtesting (id, name, state) values (?, ?, ?)", [(1000, 'this,has,a,comma', 'and a " quote')])
c.execute("insert into zxtesting (id, name, state) values (?, ?, ?)", [(1001, 'this,has,a,comma and a "', 'and a " quote')])
# ORACLE has a problem calling stmt.setObject(index, null)
c.execute("insert into zxtesting (id, name, state) values (?, ?, ?)", [(1010, '"this,has,a,comma"', None)], {2:zxJDBC.VARCHAR})
self.db.commit()
finally:
self.db.rollback()
c.close()
dbSource = DBSource(src, c.datahandler.__class__, "zxtesting", None, None, None)
cnt = Pipe().pipe(dbSource, csvSink) - 1 # ignore the header row
finally:
writer.close()
src.close()
os.remove(fn)
示例3: ig_dump_dot
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import close [as 别名]
def ig_dump_dot(dmuid,filename):
igm = project.getIGM()
uid = DMUID.parse(dmuid)
module = igm.findModule(Toplevel(uid, None))
if module == None:
printf('DM %s not found', dmuid)
else:
printf('Dumping %s...', module)
dot = IG2DOT(module);
dot.blacklistField("fImportedLibs");
dot.blacklistField("fImportedPackages");
dot.blacklistField("fZPrjID");
dot.blacklistField("fSFDBID");
dot.blacklistField("fLine");
dot.blacklistField("fCol");
dot.blacklistField("fScore");
dot.blacklistField("fFailed");
dot.blacklistField("fReject");
dot.blacklistField("fInertial");
dot.blacklistField("fDelay");
out = PrintWriter(BufferedWriter(FileWriter(filename)));
dot.convert(out);
out.close()
printf("python: wrote dot file to %s", filename)
示例4: dm_dump_dot
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import close [as 别名]
def dm_dump_dot(dmuid,filename):
dmm = project.getDUM()
uid = DMUID.parse(dmuid)
dm = dmm.getDM(uid)
if dm == None:
printf('DM %s not found', dmuid)
else:
printf('Dumping %s...', dm)
dot = AST2DOT(dm, project.getZDB())
dot.blacklistField("fParent")
# dot.blacklistField("fSource")
# dot.blacklistField("fStartCol")
# dot.blacklistField("fStartLine")
dot.blacklistField("fEndCol")
dot.blacklistField("fEndLine")
dot.blacklistField("fDeclarationMap")
out = PrintWriter(BufferedWriter(FileWriter(filename)));
dot.convert(out);
out.close()
printf("python: wrote dot file to %s", filename)
示例5: register_script
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import close [as 别名]
def register_script(self):
"""
Registers a pig scripts with its variables substituted.
raises: IOException If a temp file containing the pig script could not be created.
raises: ParseException The pig script could not have all its variables substituted.
todo: Refactor this processes that result in calling this method. This method gets
called twice for a single assert as every method that needs the data assumes no one
else has called it (even methods that call other methods that call it (assertOutput()
calls get_alias() which both call this method).
"""
pigIStream = BufferedReader(StringReader(self.orig_pig_code))
pigOStream = StringWriter()
ps = ParameterSubstitutionPreprocessor(50) # Where does 50 come from?
ps.genSubstitutedFile(pigIStream, pigOStream, self.args, self.arg_files)
substitutedPig = pigOStream.toString()
f = File.createTempFile("tmp", "pigunit")
pw = PrintWriter(f)
pw.println(substitutedPig)
pw.close()
pigSubstitutedFile = f.getCanonicalPath()
self._temp_pig_script = pigSubstitutedFile
self.pig.registerScript(pigSubstitutedFile, self.alias_overrides)
示例6: createInputFile
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import close [as 别名]
def createInputFile(self, fs, fileName, input_data):
if(fs.exists(Path(fileName))):
raise IOException("File " + fileName + " already exists on the minicluster")
stream = fs.create(Path(fileName))
pw = PrintWriter(OutputStreamWriter(stream, "UTF-8"))
for i in xrange(len(input_data)):
pw.println(input_data[i])
pw.close();
示例7: _testXMLPipe
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import close [as 别名]
def _testXMLPipe(self):
"""testing the XML pipe"""
from java.io import PrintWriter, FileWriter
from com.ziclix.python.sql.pipe import Pipe
from com.ziclix.python.sql.pipe.db import DBSource
from com.ziclix.python.sql.pipe.xml import XMLSink
try:
src = self.connect()
fn = tempfile.mktemp(suffix="csv")
writer = PrintWriter(FileWriter(fn))
xmlSink = XMLSink(writer)
dbSource = DBSource(src, self.datahandler, "zxtesting", None, None, None)
cnt = Pipe().pipe(dbSource, xmlSink) - 1 # ignore the header row
finally:
writer.close()
src.close()
os.remove(fn)
示例8: _parse_and_rewrite_svg_file
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import close [as 别名]
def _parse_and_rewrite_svg_file(svg_input_path, svg_output_path):
write_str = ""
file_reader = FileReader(svg_input_path)
buffered_reader = BufferedReader(file_reader)
read_line = ""
while True:
read_line = buffered_reader.readLine()
if read_line is None:
break
if "viewBox" in read_line:
view_box_content = _get_viewbox_content(read_line)
view_box_values = _get_viewbox_values(view_box_content)
if view_box_values[0] != 0:
view_box_values[2] += view_box_values[0]
view_box_values[0] = 0
if view_box_values[1] != 0:
view_box_values[3] += view_box_values[1]
view_box_values[1] = 0
new_view_box = str(view_box_values[0]) + " " + str(view_box_values[1]) + " " + \
str(view_box_values[2]) + " " + str(view_box_values[3])
read_line = re.sub(r"viewBox=\"[\-|0-9| ]+\"", "viewBox=\""
+ new_view_box + "\"", read_line, 1)
read_line = re.sub(r"width=\"[0-9]+\"", "width=\""+ str(view_box_values[2]) + "\"",
read_line, 1)
read_line = re.sub(r"height=\"[0-9]+\"", "height=\""+ str(view_box_values[3]) + "\"",
read_line, 1)
write_str += read_line + "\n"
buffered_reader.close()
file_reader.close()
file_writer = PrintWriter(svg_output_path)
file_writer.print(write_str)
file_writer.close()