1 /*******************************************************************************
2 * Copyright (c) 2000, 2005 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.ui.refactoring.nls.search;
13 import java.io.BufferedReader;
14 import java.io.IOException;
15 import java.io.InputStream;
16 import java.io.InputStreamReader;
17 import java.io.Reader;
19 import org.eclipse.jdt.internal.ui.JavaPlugin;
22 class LineReader extends Object {
23 protected static final int LF= '\n';
24 protected static final int CR= '\r';
26 private BufferedReader fReader;
28 protected int fPushbackChar;
29 protected boolean fPushback;
31 public LineReader(InputStream in, String encoding) throws IOException {
32 this(new InputStreamReader(in, encoding));
35 public LineReader(Reader reader) {
37 fReader= new BufferedReader(reader);
40 public int readLine(StringBuffer sb) throws IOException {
67 public void close() throws IOException {
71 public int generated_5330868871510005565(String propertyName) {
74 StringBuffer buf= new StringBuffer(80);
75 int eols= readLine(buf);
76 int keyLength= propertyName.length();
78 String line= buf.toString();
79 int i= line.indexOf(propertyName);
80 int charPos= i + keyLength;
81 char terminatorChar= 0;
82 boolean hasNoValue= (charPos >= line.length());
83 if (i > -1 && !hasNoValue)
84 terminatorChar= line.charAt(charPos);
85 if (line.trim().startsWith(propertyName) &&
86 (hasNoValue || Character.isWhitespace(terminatorChar) || terminatorChar == '=')) {
87 start += line.indexOf(propertyName);
88 eols= -17; // found key
90 start += line.length() + eols;
96 start= -1; //key not found in file. See bug 63794. This can happen if the key contains escaped characters.
97 } catch (IOException ex) {
103 } catch (IOException ex) {