public override List compile(Stream instream, PrintStream ps) { string s, sp = null; reset(); while ((s = ReadLine(instream)) != null) { sp = s; translate(s); if (ready()) { break; } else { if (ps != null) { ps.print("> "); } } } if (sp == null) { return(null); } if (s == null && State.InList == IN_BLOCK) { List v = State.Tokens; State = (ParserState)State.Sub; State.Tokens.Add(v); } return(get()); }
public override void Run(StoreAccess store, PrintStream @out) { foreach (NamedToken token in (( RelationshipTypeTokenStore )store.RelationshipTypeTokenStore).Tokens) { @out.println(token); } }
public void Encode(OutputStream output, Indentation indenter) { var @out = new PrintStream(output); @out.PrintLine(indenter + "<Request"); indenter.Down(); IEnumerator itr = this._otherattributes.Keys.GetEnumerator(); while (itr.MoveNext()) { var name = (string)itr.Current; @out.PrintLine(indenter + name + "=\"" + this._otherattributes[name] + "\""); } @out.PrintLine(indenter + "ReturnPolicyIdList=" + "\"" + this._returnPolicyIdList.Encode() + "\""); @out.PrintLine(indenter + "CombinedDecision=" + "\"" + this._combinedDecision.Encode() + "\">"); foreach (RequestDefaults r in this._requestDefaults) { r.Encode(output, indenter); } foreach (MultiRequests m in this._multiRequests) { m.Encode(output, indenter); } foreach (Attributes a in this._attributes) { a.Encode(output, indenter); } indenter.Up(); @out.PrintLine(indenter + "</Request>"); }
protected internal void Print(PrintStream @out, Exception exception, string linePrefix) { if (exception != null) { @out.println(", exception:"); MemoryStream buf = new MemoryStream(); PrintStream sbuf = new PrintStream(buf); exception.printStackTrace(sbuf); sbuf.flush(); StreamReader reader = new StreamReader(new StringReader(buf.ToString())); try { string line = reader.ReadLine(); while (!string.ReferenceEquals(line, null)) { @out.print(linePrefix); @out.print('\t'); @out.println(line); line = reader.ReadLine(); } @out.print(linePrefix); } catch (IOException e) { throw new Exception(e); } } }
public void Encode(OutputStream output, Indentation indenter) { var psout = new PrintStream(output); psout.PrintLine( indenter + "<Rule RuleId=\"" + this._ruleId.Encode() + "\" Effect=\"" + this._effect + "\">"); if (this._isRuleReference == false) { indenter.Down(); if (this._description != null) { this._description.Encode(output, indenter); } if (this._target != null) { this._target.Encode(output, indenter); } if (this._condition != null) { this._condition.Encode(output, indenter); } if (this._obligationExpressions != null) { this._obligationExpressions.Encode(output, indenter); } if (this._adviceExpressions != null) { this._adviceExpressions.Encode(output, indenter); } indenter.Up(); } psout.PrintLine(indenter + "</Rule>"); }
public override void Print(PrintStream p) { int max = 0; foreach (var t in a) { for (int k = 0; k < a[0].Length; k++) { int l = StringFmt.Compact(t[k].ToString()).Length; if (l > max) { max = l; } } } max += 2; for (int i = 0; i < a.Length; i++) { p.print("\n "); for (int k = 0; k < a[0].Length; k++) { string r = StringFmt.Compact(a[i][k].ToString()); p.print(r); for (int m = 0; m < max - r.Length; m++) { p.print(" "); } } } }
/// <summary> /// Dumps a label scan write log as plain text. Arguments: /// <ul> /// <li>{@value #ARG_TOFILE}: dumps to a .txt file next to the writelog</li> /// <li>{@value #ARG_TXFILTER}: filter for which tx ids to include in the dump. /// <para> /// Consists of one or more groups separated by comma. /// </para> /// <para> /// Each group is either a txId, or a txId range, e.g. 123-456 /// </li> /// </ul> /// </para> /// <para> /// How to interpret the dump, e.g: /// <pre> /// === ..../neostore.labelscanstore.db.writelog === /// [1,1]+tx:6,node:0,label:0 /// [1,1]+tx:3,node:20,label:0 /// [1,1]+tx:4,node:40,label:0 /// [1,1]+tx:5,node:60,label:0 /// [2,1]+tx:8,node:80,label:1 /// [3,1]+tx:10,node:41,label:1 /// [4,1]+tx:9,node:21,label:1 /// [4,1]+tx:11,node:61,label:1 /// [4,1]+range:0,labelId:1 /// [00000000 00000000 00000010 00000000 00000000 00000000 00000000 00000000] /// [00100000 00000000 00000000 00000000 00000000 00100000 00000000 00000000] /// [5,1]+tx:12,node:81,label:1 /// [5,1]+range:1,labelId:1 /// [00000000 00000000 00000000 00000000 00000000 00000001 00000000 00000000] /// [00000000 00000000 00000000 00000000 00000000 00000010 00000000 00000000] /// [6,1]+tx:13,node:1,label:1 /// [6,1]+range:0,labelId:1 /// [00100000 00000000 00000010 00000000 00000000 00100000 00000000 00000000] /// [00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000010] /// [7,1]+tx:14,node:62,label:1 /// [7,1]+range:0,labelId:1 /// </pre> /// How to interpret a message like: /// <pre> /// [1,1]+tx:6,node:0,label:0 /// ▲ ▲ ▲ ▲ ▲ ▲ /// │ │ │ │ │ └──── label id of the change /// │ │ │ │ └──────────── node id of the change /// │ │ │ └─────────────────── id of transaction making this particular change /// │ │ └─────────────────────── addition, a minus means removal /// │ └───────────────────────── flush, local to each write session, incremented when a batch of changes is flushed internally in a writer session /// └─────────────────────────── write session, incremented for each <seealso cref="LabelScanStore.newWriter()"/> /// </pre> /// How to interpret a message like: /// <pre> /// [4,1]+range:0,labelId:1 /// [00000000 00000000 00000010 00000000 00000000 00000000 00000000 00000000] /// [00100000 00000000 00000000 00000000 00000000 00100000 00000000 00000000] /// </pre> /// First the first line (parts within bracket same as above): /// <pre> /// [4,1]+range:0,labelId:1 /// ▲ ▲ /// │ └── label id of the changed bitset to apply /// └──────────── range, i.e. which bitset to apply this change for /// </pre> /// Then the bitsets are printed /// <pre> /// [00000000 00000000 00000010 00000000 00000000 00000000 00000000 00000000] : state of the bitset for this label id before the change /// [00100000 00000000 00000000 00000000 00000000 00100000 00000000 00000000] : bits that applied to this bitset /// for addition the 1-bits denotes bits to be added /// for removal the 1-bits denotes bits to be removed /// </pre> /// </para> /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void main(String[] args) throws java.io.IOException public static void Main(string[] args) { Args arguments = Args.withFlags(ARG_TOFILE).parse(args); if (arguments.Orphans().Count == 0) { Console.Error.WriteLine("Please supply database directory"); return; } DatabaseLayout databaseLayout = DatabaseLayout.of(new File(arguments.Orphans()[0])); FileSystemAbstraction fs = new DefaultFileSystemAbstraction(); TxFilter txFilter = ParseTxFilter(arguments.Get(ARG_TXFILTER, null)); PrintStream @out = System.out; bool redirectsToFile = arguments.GetBoolean(ARG_TOFILE); if (redirectsToFile) { File outFile = new File(WriteLogBaseFile(databaseLayout).AbsolutePath + ".txt"); Console.WriteLine("Redirecting output to " + outFile); @out = new PrintStream(new BufferedOutputStream(new FileStream(outFile, FileMode.Create, FileAccess.Write))); } Dumper dumper = new PrintStreamDumper(@out); Dump(fs, databaseLayout, dumper, txFilter); if (redirectsToFile) { @out.close(); } }
/// <summary> /// Creates a new LeipzigDoccatSampleStream with the specified parameters. /// </summary> /// <param name="language"> the Leipzig input sentences.txt file </param> /// <param name="sentencesPerDocument"> the number of sentences which should be grouped into once <seealso cref="DocumentSample"/> </param> /// <param name="in"> the InputStream pointing to the contents of the sentences.txt input file </param> /// <exception cref="IOException"> IOException </exception> internal LeipzigDoccatSampleStream(string language, int sentencesPerDocument, InputStream @in) : base(new PlainTextByLineStream(@in, "UTF-8")) { var ps = new PrintStream(Console.OpenStandardOutput(), true, "UTF-8"); this.language = language; this.sentencesPerDocument = sentencesPerDocument; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void exitWithFailureIfConfigSpecifiedButConfigFileDoesNotExist() public virtual void ExitWithFailureIfConfigSpecifiedButConfigFileDoesNotExist() { // given File configFile = _testDirectory.file("nonexistent_file"); string[] args = new string[] { "-host", "localhost", "-to", "my_backup", "-config", configFile.Path }; BackupProtocolService service = mock(typeof(BackupProtocolService)); PrintStream systemOut = mock(typeof(PrintStream)); BackupTool backupTool = new BackupTool(service, systemOut); try { // when backupTool.Run(args); fail("should exit abnormally"); } catch (BackupTool.ToolFailureException e) { // then assertThat(e.Message, containsString("Could not read configuration file")); assertThat(e.InnerException, instanceOf(typeof(ConfigLoadIOException))); } verifyZeroInteractions(service); }
public static void DumpVmInfo(PrintStream @out) { // Find the top thread group ThreadGroup topThreadGroup = Thread.CurrentThread.ThreadGroup; while (topThreadGroup.Parent != null) { topThreadGroup = topThreadGroup.Parent; } // Get all the thread groups under the top. ThreadGroup[] allGroups = new ThreadGroup[1000]; topThreadGroup.enumerate(allGroups, true); // Dump the info. foreach (ThreadGroup group in allGroups) { if (group == null) { break; } DumpThreadGroupInfo(group, @out); } DumpThreadGroupInfo(topThreadGroup, @out); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void addToArchive(java.nio.file.Path archiveDestination, org.neo4j.diagnostics.DiagnosticsReporterProgress progress) throws java.io.IOException public void addToArchive(Path archiveDestination, DiagnosticsReporterProgress progress) { using (PrintStream printStream = new PrintStream(Files.newOutputStream(archiveDestination))) { _outerInstance.systemProperties.list(printStream); } }
public virtual void setInputStream(InputStream @is, bool bigEndian) { this.bigEndian = bigEndian; if (this.binary) { this.binaryStream = new DataInputStream(new BufferedInputStream(@is)); if (bigEndian) { this.numPoints = this.binaryStream.readInt(); [email protected]("BigEndian"); } else { this.numPoints = Utilities.readLittleEndianInt(this.binaryStream); [email protected]("LittleEndian"); } PrintStream @out = java.lang.System.@out; StringBuilder stringBuilder = new StringBuilder().append("Frames: "); int num = this.numPoints; int num2 = this.cepstrumLength; @out.println(stringBuilder.append((num2 != -1) ? (num / num2) : (-num)).toString()); } else { this.est = new ExtendedStreamTokenizer(@is, false); this.numPoints = this.est.getInt("num_frames"); this.est.expectString("frames"); } this.curPoint = -1; this.firstSampleNumber = 0L; }
internal virtual void Putcs(PrintStream @out, char c, int count) { for (int i = 0; i < count; i++) { @out.print(c); } }
public override void Run(StoreAccess store, PrintStream @out) { foreach (NamedToken token in (( PropertyKeyTokenStore )store.PropertyKeyTokenStore).Tokens) { @out.println(token); } }
public static void dumpComponentAsGDL(ConfigurationManager cm, PrintStream @out, string name) { @out.println(new StringBuilder().append("node: {title: \"").append(name).append("\" color: ").append(GDLDumper.getColor(cm, name)).append('}').toString()); PropertySheet propertySheet = cm.getPropertySheet(name); Collection registeredProperties = propertySheet.getRegisteredProperties(); Iterator iterator = registeredProperties.iterator(); while (iterator.hasNext()) { string text = (string)iterator.next(); PropertyType type = propertySheet.getType(text); object raw = propertySheet.getRaw(text); if (raw != null) { if (type == PropertyType.__COMPONENT) { @out.println(new StringBuilder().append("edge: {source: \"").append(name).append("\" target: \"").append(raw).append("\"}").toString()); } else if (type == PropertyType.__COMPONENT_LIST) { List list = (List)raw; Iterator iterator2 = list.iterator(); while (iterator2.hasNext()) { object obj = iterator2.next(); @out.println(new StringBuilder().append("edge: {source: \"").append(name).append("\" target: \"").append(obj).append("\"}").toString()); } } } } }
internal static void PrintValue(PrintStream @out, long value, string description, System.Func <long, string> toStringConverter) { if (value > 0) { PrintIndented(@out, description + ": " + toStringConverter(value)); } }
private static void outputLicenseHeader(PrintStream ps) { String[] lines = { "Licensed to the Apache Software Foundation (ASF) under one or more", "contributor license agreements. See the NOTICE file distributed with", "this work for Additional information regarding copyright ownership.", "The ASF licenses this file to You under the Apache License, Version 2.0", "(the \"License\"); you may not use this file except in compliance with", "the License. You may obtain a copy of the License at", "", " http://www.apache.org/licenses/LICENSE-2.0", "", "Unless required by applicable law or agreed to in writing, software", "distributed under the License is distributed on an \"AS IS\" BASIS,", "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", "See the License for the specific language governing permissions and", "limitations under the License.", }; for (int i = 0; i < lines.Length; i++) { ps.print("# "); ps.println(lines[i]); } ps.println(); }
public static void dumpHeader(PrintStream @out) { @out.println("<html><head>"); @out.println(" <title> Sphinx-4 Configuration</title"); @out.println("</head>"); @out.println("<body>"); }
public void Encode(OutputStream output, Indentation indenter) { var psout = new PrintStream(output); psout.PrintLine(indenter + "<Result>"); indenter.Down(); this._decision.Encode(output, indenter); if (this._status != null) { this._status.Encode(output, indenter); } if (this._obligations != null) { this._obligations.Encode(output, indenter); } if (this._associatedAdvices != null) { this._associatedAdvices.Encode(output, indenter); } if (this._policyIdentifierList != null) { this._policyIdentifierList.Encode(output, indenter); } foreach (Attributes attrs in this._attributes) { attrs.Encode(output, indenter); } indenter.Up(); psout.PrintLine(indenter + "</Result>"); }
internal ConsistencyCheckTool(ConsistencyCheckService consistencyCheckService, FileSystemAbstraction fs, PrintStream systemOut, PrintStream systemError) { this._consistencyCheckService = consistencyCheckService; this._fs = fs; this._systemOut = systemOut; this._systemError = systemError; }
public void Encode(OutputStream output, Indentation indenter) { var psout = new PrintStream(output); psout.PrintLine( indenter + "<PolicySetCombinerParameters PolicySetIdRef=\"" + this._policySetIdRef + "\" />"); }
public static void Log(string message, PrintStream stream) { if (streamPrintEnabled [(int)stream]) { PrintToUnityLog("[" + stream + "] " + message); } }
private void EncodeChild(Node node, PrintStream psout, Indentation indenter) { psout.Print(indenter + "<" + node.NodeName); NamedNodeMap attrs = this._node.Attributes; for (int i = 0; i < attrs.Length; i++) { Node attr = attrs.Item(i); psout.Print(" " + attr.NodeName + "=\"" + attr.NodeValue + "\" "); } psout.Print("> "); psout.PrintLine(); indenter.Down(); NodeList children = node.ChildNodes; for (int i = 0; i < children.Length; i++) { Node child = children.Item(i); if (child.NodeType == Node.ELEMENT_NODE) { this.EncodeChild(child, psout, indenter); } else { string txt = child.TextContent.Trim(); if (txt.Length > 0) { psout.PrintLine(indenter + txt); } } } indenter.Up(); psout.PrintLine(indenter + "</" + node.NodeName + ">"); }
internal static string BuildMessage(Deque <StackTraceElement[]> openCloseTraces) { if (openCloseTraces.Empty) { return(StringUtils.EMPTY); } int separatorLength = 80; string paddingString = "="; MemoryStream @out = new MemoryStream(); PrintStream printStream = new PrintStream(@out); printStream.println(); printStream.println("Last " + STATEMENT_TRACK_HISTORY_MAX_SIZE + " statements open/close stack traces are:"); int element = 0; foreach (StackTraceElement[] traceElements in openCloseTraces) { printStream.println(StringUtils.center("*StackTrace " + element + "*", separatorLength, paddingString)); foreach (StackTraceElement traceElement in traceElements) { printStream.println("\tat " + traceElement); } printStream.println(StringUtils.center("", separatorLength, paddingString)); printStream.println(); element++; } printStream.println("All statement open/close stack traces printed."); return(@out.ToString()); }
public override void Run(StoreAccess store, PrintStream @out) { RecordStore <NodeRecord> nodeStore = store.NodeStore; NodeRecord node = nodeStore.GetRecord(Id, nodeStore.NewRecord(), NORMAL); if (node.Dense) { RecordStore <RelationshipGroupRecord> relationshipGroupStore = store.RelationshipGroupStore; RelationshipGroupRecord group = relationshipGroupStore.NewRecord(); relationshipGroupStore.GetRecord(node.NextRel, group, NORMAL); do { @out.println("group " + group); @out.println("out:"); PrintRelChain(store, @out, group.FirstOut); @out.println("in:"); PrintRelChain(store, @out, group.FirstIn); @out.println("loop:"); PrintRelChain(store, @out, group.FirstLoop); group = group.Next != -1 ? relationshipGroupStore.GetRecord(group.Next, group, NORMAL) : null; } while (group != null); } else { PrintRelChain(store, @out, node.NextRel); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void run(String[] args, java.io.PrintStream out) throws Exception public override void Run(string[] args, PrintStream @out) { long?[] longValues = new long?[args.Length]; for (int i = 0; i < args.Length; i++) { longValues[i] = Convert.ToInt64(args[i]); } MutableLong key = new MutableLong(); try { using (Writer <MutableLong, MutableLong> writer = outerInstance.tree.Writer()) { foreach (long?longValue in longValues) { key.Value = longValue; writer.Remove(key); } } } catch (IOException e) { throw new Exception(e); } outerInstance.maybePrint(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected void run(org.neo4j.helpers.Args args, java.io.PrintStream out) throws Exception protected internal override void Run( Args args, PrintStream @out ) { DependencyResolver dependencyResolver = _to.get().DependencyResolver; TransactionIdStore txIdStore = dependencyResolver.ResolveDependency( typeof( TransactionIdStore ) ); Config config = dependencyResolver.ResolveDependency( typeof( Config ) ); long fromTx = txIdStore.LastCommittedTransaction.transactionId(); long toTx; if ( args.Orphans().Count == 0 ) { throw new System.ArgumentException( "No tx specified" ); } string whereTo = args.Orphans()[0]; if ( whereTo.Equals( "next" ) ) { toTx = fromTx + 1; } else if ( whereTo.Equals( "last" ) ) { toTx = long.MaxValue; } else { toTx = long.Parse( whereTo ); } long lastApplied = ApplyTransactions( _from, _to.get(), config, fromTx, toTx, @out ); @out.println( "Applied transactions up to and including " + lastApplied ); }
internal PipeTask(string prefix, Stream source, PrintStream target) { this.Prefix = prefix; this.Source = source; this.Target = target; Line = new StringBuilder(); }
public MonitorAnonymousInnerClass(DumpLogicalLog outerInstance, PrintStream @out, System.Predicate <LogEntry[]> filter, System.Func <LogEntry, string> serializer) { this.outerInstance = outerInstance; this.@out = @out; this._filter = filter; this._serializer = serializer; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("ResultOfMethodCallIgnored") @Test public void begin_and_execute_periodic_commit_that_fails() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void BeginAndExecutePeriodicCommitThatFails() { File file = File.createTempFile("begin_and_execute_periodic_commit_that_fails", ".csv").AbsoluteFile; try { PrintStream @out = new PrintStream(new FileStream(file, FileMode.Create, FileAccess.Write)); @out.println("1"); @out.println("2"); @out.println("0"); @out.println("3"); @out.close(); string url = file.toURI().toURL().ToString().Replace("\\", "\\\\"); string query = "USING PERIODIC COMMIT 1 LOAD CSV FROM \\\"" + url + "\\\" AS line CREATE ({name: 1/toInt(line[0])});"; // begin and execute and commit HTTP.RawPayload payload = quotedJson("{ 'statements': [ { 'statement': '" + query + "' } ] }"); HTTP.Response response = POST(TxCommitUri(), payload); assertThat(response.Status(), equalTo(200)); assertThat(response, hasErrors(Org.Neo4j.Kernel.Api.Exceptions.Status_Statement.ArithmeticError)); JsonNode message = response.Get("errors").get(0).get("message"); assertTrue("Expected LOAD CSV line number information", message.ToString().Contains("on line 3. Possibly the last row committed during import is line 2. " + "Note that this information might not be accurate.")); } finally { file.delete(); } }
private static void ProcessFile(File effDocFile, File outFile) { if (!effDocFile.exists()) { throw new RuntimeException("file '" + effDocFile.GetAbsolutePath() + "' does not exist"); } OutputStream os; try { os = new FileOutputStream(outFile); } catch (FileNotFoundException e) { throw new RuntimeException(e); } os = new SimpleAsciiOutputStream(os); PrintStream ps; try { ps = new PrintStream(os, true, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } outputLicenseHeader(ps); Type genClass = typeof(ExcelFileFormatDocFunctionExtractor); ps.println("# Created by (" + genClass.Name + ")"); // identify the source file ps.print("# from source file '" + SOURCE_DOC_FILE_NAME + "'"); ps.println(" (size=" + effDocFile.Length + ", md5=" + GetFileMD5(effDocFile) + ")"); ps.println("#"); ps.println("#Columns: (index, name, minParams, maxParams, returnClass, paramClasses, isVolatile, hasFootnote )"); ps.println(""); try { ZipFile zf = new ZipFile(effDocFile); InputStream is1 = zf.GetInputStream(zf.GetEntry("content.xml")); extractFunctionData(new FunctionDataCollector(ps), is1); zf.Close(); } catch (ZipException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } ps.Close(); String canonicalOutputFileName; try { canonicalOutputFileName = outFile.GetCanonicalPath(); } catch (IOException e) { throw new RuntimeException(e); } Console.WriteLine("Successfully output to '" + canonicalOutputFileName + "'"); }
public override void printStats(PrintStream @out) { @out.println("Value space size = " + Convert.ToString(vspace.length())); base.printStats(@out); }
public virtual void list(PrintStream @out) { Delegate.list(@out); }