Changeset 1933e62


Ignore:
Timestamp:
Aug 30, 2013 10:21:57 AM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
de5f294
Parents:
8aec1e2e
Message:
  • SusiDNS: Don't require last subscription to be terminated by newline (ticket #1000)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/data/DataHelper.java

    r8aec1e2e r1933e62  
    11711171    /**
    11721172     * Read a newline delimited line from the stream, returning the line (without
    1173      * the newline), or null if EOF reached before the newline was found
     1173     * the newline), or null if EOF reached on an empty line
    11741174     * Warning - strips \n but not \r
    11751175     * Warning - 8KB line length limit as of 0.7.13, @throws IOException if exceeded
    11761176     * Warning - not UTF-8
     1177     *
     1178     * @return null on EOF
    11771179     */
    11781180    public static String readLine(InputStream in) throws IOException { return readLine(in, (MessageDigest) null); }
     
    11831185     * Warning - 8KB line length limit as of 0.7.13, @throws IOException if exceeded
    11841186     * Warning - not UTF-8
     1187     *
     1188     * @param hash null OK
     1189     * @return null on EOF
    11851190     * @deprecated use MessageDigest version
    11861191     */
     
    11991204     * Warning - 8KB line length limit as of 0.7.13, @throws IOException if exceeded
    12001205     * Warning - not UTF-8
     1206     *
     1207     * @param hash null OK
     1208     * @return null on EOF
    12011209     * @since 0.8.8
    12021210     */
     
    12151223     * Warning - 8KB line length limit as of 0.7.13, @throws IOException if exceeded
    12161224     * Warning - not UTF-8
     1225     *
    12171226     * @deprecated use StringBuilder version
    1218      *
    1219      * @return true if the line was read, false if eof was reached before a
    1220      *              newline was found
     1227     * @return true if the line was read, false if eof was reached on an empty line
     1228     *              (returns true for non-empty last line without a newline)
    12211229     */
    12221230    @Deprecated
     
    12331241     * Warning - 8KB line length limit as of 0.7.13, @throws IOException if exceeded
    12341242     * Warning - not UTF-8
     1243     *
     1244     * @return true if the line was read, false if eof was reached on an empty line
     1245     *              (returns true for non-empty last line without a newline)
    12351246     * @deprecated use StringBuilder / MessageDigest version
    12361247     */
     
    12471258            buf.append((char)c);
    12481259        }
    1249         if (c == -1)
    1250             return false;
    1251         else
    1252             return true;
     1260        return c != -1 || i > 0;
    12531261    }
    12541262   
     
    12591267     * Warning - not UTF-8
    12601268     *
    1261      * @return true if the line was read, false if eof was reached before a
    1262      *              newline was found
     1269     * @return true if the line was read, false if eof was reached on an empty line
     1270     *              (returns true for non-empty last line without a newline)
    12631271     */
    12641272    public static boolean readLine(InputStream in, StringBuilder buf) throws IOException {
     
    12711279     * Warning - 8KB line length limit as of 0.7.13, @throws IOException if exceeded
    12721280     * Warning - not UTF-8
     1281     *
     1282     *
     1283     * @param hash null OK
     1284     * @return true if the line was read, false if eof was reached on an empty line
     1285     *              (returns true for non-empty last line without a newline)
    12731286     * @deprecated use MessageDigest version
    12741287     */
     
    12841297            buf.append((char)c);
    12851298        }
    1286         return c != -1;
     1299        return c != -1 || i > 0;
    12871300    }
    12881301   
     
    12921305     * Warning - 8KB line length limit as of 0.7.13, @throws IOException if exceeded
    12931306     * Warning - not UTF-8
     1307     *
     1308     * @param hash null OK
     1309     * @return true if the line was read, false if eof was reached on an empty line
     1310     *              (returns true for non-empty last line without a newline)
    12941311     * @since 0.8.8
    12951312     */
     
    13051322            buf.append((char)c);
    13061323        }
    1307         return c != -1;
     1324        return c != -1 || i > 0;
    13081325    }
    13091326   
Note: See TracChangeset for help on using the changeset viewer.