private InputStream delegate() throws IOException { if (delegate == null) { delegate = new StringInputStream(string, encoding); } return delegate; }
boolean contentChanged = false; BufferedInputStream oldContent = null; StringInputStream newContent = new StringInputStream(newContentAsString, defaultCharset); try { oldContent = new BufferedInputStream(file.getContents()); int newByte = newContent.read(); int oldByte = oldContent.read(); while(newByte != -1 && oldByte != -1 && newByte == oldByte) { newByte = newContent.read(); oldByte = oldContent.read(); newContent.reset(); file.create(new StringInputStream(newContentAsString, defaultCharset), true, null); file.setDerived(true); if(newFileAcceptor != null)
newContent.reset(); file.setContents(newContent, true, true, monitor); } else {
protected InputStream getAsStream(String model) { return new StringInputStream(model); }
protected InputStream getAsStream(String model) { return new StringInputStream(model); }
protected InputStream getAsStream(String model) { return new StringInputStream(model); }
protected InputStream getAsStream(CharSequence text) { return new StringInputStream(text.toString()); }
protected InputStream getAsStream(CharSequence text) { return new StringInputStream(text == null ? "" : text.toString()); }
public void addModel(String uri, String content) { models.put(URI.createURI(uri), new StringInputStream(content)); }
protected StringInputStream getInputStream(String contentsAsString, String encoding) { try { return new StringInputStream(contentsAsString, encoding); } catch (UnsupportedEncodingException e) { throw new RuntimeIOException(e); } }
/** * @since 2.4 */ public InputStream readBinaryFile(String fileName, String outputCfgName) throws RuntimeIOException { String name = getFileName(fileName, outputCfgName); Object contents = files.get(name); if (contents == null) throw new RuntimeIOException("File not found: " + name); if (contents instanceof byte[]) return new ByteArrayInputStream((byte[]) contents); if (contents instanceof CharSequence) return new StringInputStream(contents.toString()); throw new RuntimeIOException("Unknown File Data Type: " + contents.getClass() + " File: " + name); }
protected XtextResource createResource(String content) { XtextResource result = this.resourceProvider.createResource(); try { result.load(new StringInputStream(content, result.getEncoding()), Collections.emptyMap()); } catch (Exception e) { throw new RuntimeException(e); } return result; }
/** Format the code in the given resource. * * @param resource the resource of the code to format. */ public void format(XtextResource resource) { assert resource != null; final String result = formatResource(resource); // Write back to the resource try (StringInputStream stringInputStream = new StringInputStream(result)) { resource.load(stringInputStream, Collections.emptyMap()); } catch (Exception exception) { throw Exceptions.sneakyThrow(exception); } }
/** Format the code in the given region. * * @param resource the resource to format. * @param offset the offset of the text to format. * @param length the length of the text. */ public void formatRegion(XtextResource resource, int offset, int length) { assert resource != null; assert offset >= 0; assert length >= 0; final String result = formatResourceRegion(resource, offset, length); // Write back to the resource try (StringInputStream stringInputStream = new StringInputStream(result)) { resource.load(stringInputStream, Collections.emptyMap()); } catch (Exception exception) { throw Exceptions.sneakyThrow(exception); } }
try (StringInputStream is = new StringInputStream(content.toString())) { pomFile.create(is, true, new NullProgressMonitor()); } catch (CoreException exception) {
public InputStream createInputStream(URI uri, Map<?, ?> options) throws IOException { if (contentProvider.hasContent(uri)) { return new StringInputStream(contentProvider.getContent(uri)); } return delegate.createInputStream(uri, options); }
@Override protected InputStream getInitialContents() { final StringBuilder content = new StringBuilder(); final IPath folderInWorkspace = getContainerFullPath(); final IPath packagePath = determinePackageName(folderInWorkspace); if (packagePath != null && packagePath.segmentCount() > 0) { content.append(this.grammarAccess.getPackageKeyword() + " "); //$NON-NLS-1$ final StringBuilder packageName = new StringBuilder(); packageName.append(packagePath.segment(0)); for (int i = 1; i < packagePath.segmentCount(); ++i) { packageName.append(this.grammarAccess.getFullStopKeyword()); packageName.append(packagePath.segment(i)); } content.append(this.converter.getQualifiedNameValueConverter().toString(packageName.toString())); content.append("\n"); //$NON-NLS-1$ } return new StringInputStream(content.toString()); }
String _string = processedContents.toString(); String _charset = this.getCharset(path); StringInputStream _stringInputStream = new StringInputStream(_string, _charset); this.setContentsAsStream(path, _stringInputStream); } catch (final Throwable _t) {
public void reparse(String newContent) throws IOException { try { isUpdating = true; clearInternalState(); doLoad(new StringInputStream(newContent, getEncoding()), null); setModified(false); } finally { isUpdating = false; } }
StringInputStream _stringInputStream = new StringInputStream(existingContent, "ISO-8859-1"); buildProperties.load(_stringInputStream); final String binIncludes = buildProperties.getProperty("bin.includes");