toString() public method

public toString ( ) : global::java.lang.String
return global::java.lang.String
示例#1
0
        static void Main(string[] args)
        {
            System.IO.File.Delete(@"temp.txt");
            System.IO.File.Delete(@"output.txt");
            System.IO.File.Delete(@"C:\\Main\\Walmart\\walmart.txt");

            string[] files = System.IO.Directory.GetFiles("C:\\Main\\Walmart", "*.pdf", System.IO.SearchOption.TopDirectoryOnly);

            if (files.Length == 0)
                return;

            foreach (String file in files)
            {
                StringWriter text = new StringWriter(1024);
                System.Console.Write("{0}\n", file);
                using (Document doc = PDF.open(file))
                {
                    System.Console.Clear();
                    System.Console.WriteLine("Please Wait.. Generating Files..");
                    doc.pipe(new OutputTarget(text));
                }
                System.IO.File.AppendAllText(@"temp.txt", text.toString());
                text.close();
            }
            parseTextNew();
        }
示例#2
0
        public static string ToString(Table table, TableContainType tableContainType)
        {
            java.io.StringWriter stringWriter = new java.io.StringWriter();
            try
            {
                technology.tabula.writers.Writer writer = null;
                switch (tableContainType)
                {
                case TableContainType.CSV:
                    writer = new CSVWriter();
                    break;

                case TableContainType.Json:
                    writer = new JSONWriter();
                    break;

                case TableContainType.TSV:
                    writer = new TSVWriter();
                    break;

                default:
                    writer = new JSONWriter();
                    break;
                }

                writer.write(stringWriter, table);
            }
            catch
            {
                return(string.Empty);
            }
            return(stringWriter.toString());
        }
示例#3
0
文件: NLP.cs 项目: gbolinder/OTAP
 public static JObject ProcessText(string text)
 {
     var annotation = new Annotation(text);
     using (java.io.StringWriter writer = new java.io.StringWriter())
     {
         pipeline.annotate(annotation);
         pipeline.jsonPrint(annotation, writer);
         return JObject.Parse(writer.toString());
     }
 }
示例#4
0
        public static JObject ProcessText(string text)
        {
            var annotation = new Annotation(text);

            using (java.io.StringWriter writer = new java.io.StringWriter())
            {
                pipeline.annotate(annotation);
                pipeline.jsonPrint(annotation, writer);
                return(JObject.Parse(writer.toString()));
            }
        }
示例#5
0
        /// <summary>
        /// Convert mol to V3000 Molfile
        /// </summary>
        /// <param name="mol"></param>
        /// <returns></returns>

        public static string AtomContainerToMolFileV3000(IAtomContainer mol)
        {
            java.io.StringWriter sw = new java.io.StringWriter();

            MDLV3000Writer writer = new MDLV3000Writer(sw);

            writer.write(mol);
            writer.close();
            sw.close();

            string molFile = sw.toString();

            return(molFile);
        }
示例#6
0
 public string ExtractText(byte[] data)
 {
     var parser = new AutoDetectParser();
     var handler = new BodyContentHandler();
     var context = new ParseContext();
     context.set(parser.getClass(), parser);
     var metadata = new Metadata();
     using (var output = new StringWriter()) {
         var transformerHandler = CreateTransformerHandler(output);
         using (var inputStream = TikaInputStream.get(data, metadata)) {
             parser.parse(inputStream, transformerHandler, metadata, context);
             inputStream.close();
         }
         return output.toString();
     }
 }
示例#7
0
        public override string format(LogRecord logrecord)
        {
            var stringbuilder = new StringBuilder();
            stringbuilder.append(dateFormat.format(Long.valueOf(logrecord.getMillis())));
            Level level = logrecord.getLevel();
            if (level == Level.FINEST)
            {
                stringbuilder.append(" [FINEST] ");
            }
            else if (level == Level.FINER)
            {
                stringbuilder.append(" [FINER] ");
            }
            else if (level == Level.FINE)
            {
                stringbuilder.append(" [FINE] ");
            }
            else if (level == Level.INFO)
            {
                stringbuilder.append(" [INFO] ");
            }
            else if (level == Level.WARNING)
            {
                stringbuilder.append(" [WARNING] ");
            }
            else if (level == Level.SEVERE)
            {
                stringbuilder.append(" [SEVERE] ");
            }
            else if (level == Level.SEVERE)
            {
                stringbuilder.append(
                    (new StringBuilder()).append(" [").append(level.getLocalizedName()).append("] ").toString());
            }
            stringbuilder.append(logrecord.getMessage());
            stringbuilder.append('\n');
            var throwable = logrecord.getThrown() as Throwable;
            if (throwable != null)
            {
                var stringwriter = new StringWriter();
                throwable.printStackTrace(new PrintWriter(stringwriter));
                stringbuilder.append(stringwriter.toString());
            }

            Debug.WriteLine(stringbuilder.toString());
            return stringbuilder.toString();
        }
        public virtual RewriterResults rewrite(Gadget gadget, MutableContent content)
        {
            java.io.StringWriter sw   = new java.io.StringWriter();
            GadgetSpec           spec = gadget.getSpec();
            Uri  _base = spec.getUrl();
            View view  = gadget.getCurrentView();

            if (view != null && view.getHref() != null)
            {
                _base = view.getHref();
            }
            if (rewrite(spec, _base, content, "text/html", sw))
            {
                content.setContent(sw.toString());
            }
            return(null);
        }
		public void save(IFile file) {
			try {
				var document = XmlHelper.load(new StringReader(EMPTY_DOC));
				var libs = (Element)document.getElementsByTagName("libraries").item(0);
				foreach (var lib in this.Libraries) {
					var e = document.createElement("library");
					libs.appendChild(e);
					e.setAttribute("name", lib.Path);
					if (!lib.Enabled) {
						e.setAttribute("enabled", "false");
					}
				}
				if (this.PreprocessorSymbols.any()) {
					var sb = new StringBuilder();
					var first = true;
					foreach (String s in this.PreprocessorSymbols) {
						if (first) {
							first = false;
						} else {
							sb.append(';');
						}
						sb.append(s);
					}
					var e = document.createElement("preprocessorSymbols");
					document.getDocumentElement().appendChild(e);
					e.setTextContent(sb.toString());
				}
				var outputElt = document.createElement("outputPath");
				document.getDocumentElement().appendChild(outputElt);
				outputElt.setTextContent(this.OutputPath);
				
	            var writer = new StringWriter();
				XmlHelper.save(document, writer);
	            var bytes = writer.toString().getBytes("UTF-8");
	            var stream = new ByteArrayInputStream(bytes);
	            if (file.exists()) {
	            	file.setContents(stream, IResource.FORCE, null);
	            } else {
	            	file.create(stream, true, null);
	            }
			} catch (Exception e) {
				Environment.logException(e);
			}
		}
示例#10
0
 public virtual RewriterResults rewrite(Gadget gadget, MutableContent content)
 {
     java.io.StringWriter sw = new java.io.StringWriter();
     GadgetSpec spec = gadget.getSpec();
     Uri _base = spec.getUrl();
     View view = gadget.getCurrentView();
     if (view != null && view.getHref() != null) 
     {
         _base = view.getHref();
     }
     if (rewrite(spec, _base, content, "text/html", sw)) 
     {
         content.setContent(sw.toString());
     }
     return null;
 }
示例#11
0
    public static string getFilteredTrace(string stack)
    {
      if (BaseTestRunner.showStackRaw())
        return stack;
      StringWriter stringWriter = new StringWriter();
      PrintWriter printWriter = new PrintWriter((Writer) stringWriter);
      BufferedReader bufferedReader = new BufferedReader((Reader) new StringReader(stack));
      try
      {
        string str;
        while ((str = bufferedReader.readLine()) != null)
        {
          if (!BaseTestRunner.filterLine(str))
            printWriter.println(str);
        }
        goto label_9;
      }
      catch (Exception ex)
      {
        int num = 2;
        if (ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num) == null)
          throw;
      }
      return stack;
label_9:
      return stringWriter.toString();
    }
示例#12
0
 private static string exceptionToString([In] Exception obj0)
 {
   StringWriter stringWriter = new StringWriter();
   PrintWriter printWriter = new PrintWriter((Writer) stringWriter);
   Throwable.instancehelper_printStackTrace(obj0, printWriter);
   return stringWriter.toString();
 }