public YAMLParser(IOContext ctxt, BufferRecycler br, int parserFeatures, int formatFeatures, ObjectCodec codec, Reader reader) { super(ctxt, parserFeatures); _objectCodec = codec; _formatFeatures = formatFeatures; _reader = reader; _yamlParser = new ParserImpl(new StreamReader(reader)); }
public YAMLParser(IOContext ctxt, BufferRecycler br, int parserFeatures, int formatFeatures, ObjectCodec codec, Reader reader) { super(ctxt, parserFeatures); _objectCodec = codec; _formatFeatures = formatFeatures; _reader = reader; _yamlParser = new ParserImpl(new StreamReader(reader)); }
/** * Parse the only YAML document in a String and produce the corresponding * Java object. (Because the encoding in known BOM is not respected.) * * @param yaml * YAML data to load from (BOM must not be present) * @param <T> * the class of the instance to be created * @return parsed object */ @SuppressWarnings("unchecked") public <T> T load(String yaml) { return (T) loadFromReader(new StreamReader(yaml), Object.class); }
/** * Parse the only YAML document in a stream and produce the corresponding * Java object. * * @param io * data to load from (BOM must not be present) * @param <T> * the class of the instance to be created * @return parsed object */ @SuppressWarnings("unchecked") public <T> T load(Reader io) { return (T) loadFromReader(new StreamReader(io), Object.class); }
/** * Parse the only YAML document in a stream and produce the corresponding * Java object. * * @param <T> * Class is defined by the second argument * @param io * data to load from (BOM must not be present) * @param type * Class of the object to be created * @return parsed object */ @SuppressWarnings("unchecked") public <T> T loadAs(Reader io, Class<T> type) { return (T) loadFromReader(new StreamReader(io), type); }
/** * Parse the only YAML document in a String and produce the corresponding * Java object. (Because the encoding in known BOM is not respected.) * * @param <T> * Class is defined by the second argument * @param yaml * YAML data to load from (BOM must not be present) * @param type * Class of the object to be created * @return parsed object */ @SuppressWarnings("unchecked") public <T> T loadAs(String yaml, Class<T> type) { return (T) loadFromReader(new StreamReader(yaml), type); }
/** * Parse the first YAML document in a stream and produce the corresponding * representation tree. (This is the opposite of the represent() method) * * @see <a href="http://yaml.org/spec/1.1/#id859333">Figure 3.1. Processing * Overview</a> * @param yaml * YAML document * @return parsed root Node for the specified YAML document */ public Node compose(Reader yaml) { Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver); return composer.getSingleNode(); }
/** * Parse a YAML stream and produce parsing events. * * @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a> * @param yaml * YAML document(s) * @return parsed events */ public Iterable<Event> parse(Reader yaml) { final Parser parser = new ParserImpl(new StreamReader(yaml)); Iterator<Event> result = new Iterator<Event>() { @Override public boolean hasNext() { return parser.peekEvent() != null; } @Override public Event next() { return parser.getEvent(); } @Override public void remove() { throw new UnsupportedOperationException(); } }; return new EventIterable(result); }
/** * Parse all YAML documents in a stream and produce corresponding * representation trees. * * @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a> * @param yaml * stream of YAML documents * @return parsed root Nodes for all the specified YAML documents */ public Iterable<Node> composeAll(Reader yaml) { final Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver); Iterator<Node> result = new Iterator<Node>() { @Override public boolean hasNext() { return composer.checkNode(); } @Override public Node next() { return composer.getNode(); } @Override public void remove() { throw new UnsupportedOperationException(); } }; return new NodeIterable(result); }
/** * Parse all YAML documents in the Reader and produce corresponding Java * objects. The documents are parsed only when the iterator is invoked. * * @param yaml * YAML data to load from (BOM must not be present) * @return an Iterable over the parsed Java objects in this String in proper * sequence */ public Iterable<Object> loadAll(Reader yaml) { Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver); constructor.setComposer(composer); Iterator<Object> result = new Iterator<Object>() { @Override public boolean hasNext() { return constructor.checkData(); } @Override public Object next() { return constructor.getData(); } @Override public void remove() { throw new UnsupportedOperationException(); } }; return new YamlIterable(result); }
/** * Parse the only YAML document in a stream and produce the corresponding * Java object. * * @param io * data to load from (BOM is respected to detect encoding and removed from the data) * @param <T> * the class of the instance to be created * @return parsed object */ @SuppressWarnings("unchecked") public <T> T load(InputStream io) { return (T) loadFromReader(new StreamReader(new UnicodeReader(io)), Object.class); }
/** * Parse the only YAML document in a stream and produce the corresponding * Java object. * * @param <T> * Class is defined by the second argument * @param input * data to load from (BOM is respected to detect encoding and removed from the data) * @param type * Class of the object to be created * @return parsed object */ @SuppressWarnings("unchecked") public <T> T loadAs(InputStream input, Class<T> type) { return (T) loadFromReader(new StreamReader(new UnicodeReader(input)), type); }
BufferedReader br = new BufferedReader(new StreamReader(System.in)); String line = br.readLine();
const string GeoCodeUrlFormat = "http://maps.google.com/maps/geo?q={0}&output=csv&oe=utf8&sensor=false"; string location = "State St, Troy, NY"; string url = String.Format(GeoCodeUrlFormat, HttpUtility.UrlEncode(location)); HttpRequest request = (HttpWebRequest)HttpWebRequest.Create(url); HttpResponse response = (HttpResponse)request.GetResponse(); // Can throw an exception Stream responseStream = response.GetResponseStream(); using (StreamReader reader = new StreamReader(responseStream) { string firstLine = reader.ReadLine(); string[] lineParts = firstLine.Split(); GeolocationResult result = GoogleMapper.MapGeolocationResult(lineParts); // TADA }
asyncTask.ContinueWith() --> GetResponseText(callbackState.ResponseStream)--> using (var reader = new StreamReader(responseStream)) // responseStream is null { }
public YAMLParser(IOContext ctxt, BufferRecycler br, int parserFeatures, int formatFeatures, ObjectCodec codec, Reader reader) { super(ctxt, parserFeatures); _objectCodec = codec; _formatFeatures = formatFeatures; _reader = reader; _yamlParser = new ParserImpl(new StreamReader(reader)); }
public Form1() { InitializeComponent(); StreamReader reader = new StreamReader("alertTest.html"); string html = reader.ReadToEnd(); this.webBrowser1.DocumentText = html; }
/** * Parse the only YAML document in a stream and produce the corresponding * Java object. * * @param io * data to load from (BOM must not be present) * @return parsed object */ public Object load(Reader io) { return loadFromReader(new StreamReader(io), Object.class); }
StreamReader streamReader = new StreamReader("test.js"); string script = streamReader.ReadToEnd(); streamReader.Close(); JintEngine js = new JintEngine(); js.Run(script); object result = js.Run("return status;"); Console.WriteLine(result); Console.ReadKey();
/** * Parse the only YAML document in a stream and produce the corresponding * Java object. * * @param io * data to load from (BOM is respected and removed) * @return parsed object */ public Object load(InputStream io) { return loadFromReader(new StreamReader(new UnicodeReader(io)), Object.class); }