Changeset 10272


Ignore:
Timestamp:
10/29/05 18:21:12 (16 years ago)
Author:
piso
Message:

toCharArray()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/FastStringBuffer.java

    r9631 r10272  
    33 *
    44 * Copyright (C) 1998-2005 Peter Graves
    5  * $Id: FastStringBuffer.java,v 1.2 2005-07-10 15:19:15 piso Exp $
     5 * $Id: FastStringBuffer.java,v 1.3 2005-10-29 18:21:12 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7878    public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin)
    7979    {
    80         if (srcBegin < 0)
    81             throw new StringIndexOutOfBoundsException();
    82         if (srcBegin > srcEnd)
    83             throw new StringIndexOutOfBoundsException();
    84         if (srcEnd > used)
     80        if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > used)
    8581            throw new StringIndexOutOfBoundsException();
    8682        System.arraycopy(buffer, srcBegin, dst, dstBegin, srcEnd - srcBegin);
     
    193189        return new String(buffer, 0, used);
    194190    }
     191
     192    public final char[] toCharArray()
     193    {
     194        char[] copy = new char[used];
     195        System.arraycopy(buffer, 0, copy, 0, used);
     196        return copy;
     197    }
    195198}
Note: See TracChangeset for help on using the changeset viewer.