]> gerrit.simantics Code Review - simantics/r.git/blob - org.simantics.r.scl/src/org/rosuda/REngine/REXPRaw.java
(refs #6833) Test RExp inheritance in SCL
[simantics/r.git] / org.simantics.r.scl / src / org / rosuda / REngine / REXPRaw.java
1 package org.rosuda.REngine;
2
3 /** REXPRaw represents a raw vector in R - essentially a sequence of bytes. */
4 public class REXPRaw extends REXPVector {
5         private byte[] payload;
6         
7         /** create a new raw vector with the specified payload
8          *  @param load payload of the raw vector */
9         public REXPRaw(byte[] load) {
10                 super();
11                 payload=(load==null)?new byte[0]:load;
12         }
13
14         /** create a new raw vector with the specified payload and attributes
15          *  @param load payload of the raw vector 
16          *  @param attr attributes for the resulting R object */
17         public REXPRaw(byte[] load, REXPList attr) {
18                 super(attr);
19                 payload=(load==null)?new byte[0]:load;
20         }
21         
22         public int length() { return payload.length; }
23
24         public boolean isRaw() { return true; }
25
26         public byte[] asBytes() { return payload; }
27
28         public Object asNativeJavaObject() {
29                 return payload;
30         }
31 }