File: REXPRaw.java

package info (click to toggle)
rjava 1.0-14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,188 kB
  • sloc: java: 13,223; ansic: 5,503; sh: 3,776; xml: 325; makefile: 250; perl: 33
file content (31 lines) | stat: -rw-r--r-- 844 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.rosuda.REngine;

/** REXPRaw represents a raw vector in R - essentially a sequence of bytes. */
public class REXPRaw extends REXPVector {
	private byte[] payload;
	
	/** create a new raw vector with the specified payload
	 *  @param load payload of the raw vector */
	public REXPRaw(byte[] load) {
		super();
		payload=(load==null)?new byte[0]:load;
	}

	/** create a new raw vector with the specified payload and attributes
	 *  @param load payload of the raw vector 
	 *  @param attr attributes for the resulting R object */
	public REXPRaw(byte[] load, REXPList attr) {
		super(attr);
		payload=(load==null)?new byte[0]:load;
	}
	
	public int length() { return payload.length; }

	public boolean isRaw() { return true; }

	public byte[] asBytes() { return payload; }

	public Object asNativeJavaObject() {
		return payload;
	}
}