@Override public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } b[off] = (byte) c; int i = 1; // Don't try to fill up the buffer if the reader is waiting. for (; (i < len) && reader.ready(); i++) { c = read(); if (c == -1) { return i; } b[off + i] = (byte) c; } return i; }
private InputStream getInputStream() throws FileNotFoundException { try { return new ReaderInputStream(new StringReader(content)); } catch (IOException ex) { throw new FileNotFoundException(ex.getLocalizedMessage()); } }
/** Get properties of the platform. * @return true if the initialization has been succesfull */ private boolean processProperties(final PrintWriter pw) { properties = new Properties(); try { execute(CMD_QUERY, pw); String output = emulatorOutput.toString(); if ("".equals(output)) //NOI18N output = emulatorError.toString(); properties.load(new ReaderInputStream(new StringReader(output))); } catch (IOException ex) { ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, ex); return false; } return true; } /*
private static Set<RakeTask> parseTasks(Reader is) throws IOException { Properties tasksProps = new Properties(); tasksProps.load(new ReaderInputStream(is));
public int read(byte b[], int off, int len) throws IOException { int c = read(); if (c == -1) { return -1; } b[off] = (byte)c; int i = 1; // Don't try to fill up the buffer if the reader is waiting. for (; i < len && reader.ready(); i++) { c = read(); if (c == -1) { return i; } b[off + i] = (byte)c; } return i; }
/** Get version of the platform. * Loads temporary fields * @return true if load is successful */ private boolean processVersion(final PrintWriter pw) { versionProperties = new Properties(); try { execute(CMD_VERSION, pw); if (! resolveVersion(emulatorOutput)) if (! resolveVersion(emulatorError)) return false; // Platform detection modified because of #221063 and #228551 - Adding TC65 WTK as Java ME CLDC Platform final String output = emulatorOutput.toString(); if (output != null && !output.isEmpty()) { versionProperties.load(new ReaderInputStream(new StringReader(output))); } } catch (IOException ex) { ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, ex); return false; } // if (configuration == null) return false; // if (profile == null) return false; return true; }
public int read(byte b[], int off, int len) throws IOException { int c = read(); if (c == -1) { return -1; } b[off] = (byte)c; int i = 1; // Don't try to fill up the buffer if the reader is waiting. for (; i < len && reader.ready(); i++) { c = read(); if (c == -1) { return i; } b[off + i] = (byte)c; } return i; }
LOGGER.finer("stdout:\n" + stdout); LOGGER.finer("stderr:\n " + stderr); props.load(new ReaderInputStream(new StringReader(stdout))); } else { props.load(proc.getInputStream());
public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } b[off] = (byte) c; int i = 1; // Don't try to fill up the buffer if the reader is waiting. for (; (i < len) && reader.ready(); i++) { c = read(); if (c == -1) { return i; } b[off + i] = (byte) c; } return i; }
FileUtil.copy(new ReaderInputStream(reader, charset), fos);
@Override public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } b[off] = (byte) c; int i = 1; // Don't try to fill up the buffer if the reader is waiting. for (; (i < len) && reader.ready(); i++) { c = read(); if (c == -1) { return i; } b[off + i] = (byte) c; } return i; }