Changeset 12414


Ignore:
Timestamp:
02/02/10 19:54:37 (12 years ago)
Author:
ehuelsmann
Message:

Add function to retrieve a lisp byte array from a byte array output stream.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Autoload.java

    r12407 r12414  
    527527        autoload(PACKAGE_SYS, "%generic-function-name", "StandardGenericFunction", true);
    528528        autoload(PACKAGE_SYS, "%get-output-stream-bytes", "ByteArrayOutputStream"); //AS 20090325
     529        autoload(PACKAGE_SYS, "%get-output-stream-array", "ByteArrayOutputStream");
    529530        autoload(PACKAGE_SYS, "%make-array", "make_array");
    530531        autoload(PACKAGE_SYS, "%make-byte-array-output-stream", "ByteArrayOutputStream"); //AS 20090325
  • trunk/abcl/src/org/armedbear/lisp/BasicVector_UnsignedByte8.java

    r12288 r12414  
    4949  }
    5050
     51  public BasicVector_UnsignedByte8(byte[] array)
     52  {
     53    capacity = array.length;
     54    elements = new byte[capacity];
     55    System.arraycopy(array, 0, elements, 0, capacity);
     56  }
     57
     58
    5159  public BasicVector_UnsignedByte8(LispObject[] array)
    52 
    5360  {
    5461    capacity = array.length;
  • trunk/abcl/src/org/armedbear/lisp/ByteArrayOutputStream.java

    • Property svn:eol-style set to native
    • Property svn:keywords set to Id
    r12362 r12414  
    33 *
    44 * Copyright (C) 2009 Alessio Stalla
    5  * $Id: StringOutputStream.java 11434 2008-12-07 23:24:31Z ehuelsmann $
     5 * $Id$
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    133133        }
    134134    };
     135
     136    private static final Primitive GET_OUTPUT_STREAM_ARRAY =
     137        new Primitive("%get-output-stream-array", PACKAGE_SYS, false,
     138                      "byte-array-output-stream")
     139    {
     140        @Override
     141        public LispObject execute(LispObject arg)
     142        {
     143            if (arg instanceof ByteArrayOutputStream)
     144                return new BasicVector_UnsignedByte8(((ByteArrayOutputStream)arg).getByteArray());
     145
     146            return error(new TypeError(this, Symbol.STREAM)); // TODO
     147        }
     148    };
     149
    135150}
Note: See TracChangeset for help on using the changeset viewer.