Package org.ringojs.wrappers
Class Stream
- java.lang.Object
-
- org.mozilla.javascript.ScriptableObject
-
- org.ringojs.wrappers.Stream
-
- All Implemented Interfaces:
java.io.Serializable
,org.mozilla.javascript.ConstProperties
,org.mozilla.javascript.debug.DebuggableObject
,org.mozilla.javascript.Scriptable
,org.mozilla.javascript.SymbolScriptable
,org.mozilla.javascript.Wrapper
public class Stream extends org.mozilla.javascript.ScriptableObject implements org.mozilla.javascript.Wrapper
A CommonJS-compliant wrapper around a Java input or output stream. To register Stream as a host object in Rhino call the
defineClass()
function with this class.defineClass(org.ringojs.wrappers.Stream);
To create an Stream wrapper around an instance of
java.io.InputStream
orjava.io.OutputStream
call the constructor with the stream as argument:var io = new Stream(javaInputStream);
When passed to a Java method that expects an input or output stream, Stream wrappers are automatically unwrapped. use the
unwrap()
method to explicitly get the wrapped stream.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
closed()
void
flush()
java.lang.String
getClassName()
Return the name of the class.java.lang.Object
getInputStream()
java.lang.Object
getOutputStream()
void
init(java.lang.Object arg1, java.lang.Object arg2)
java.lang.Object
jsunwrap()
java.lang.Object
read(java.lang.Object limit)
boolean
readable()
int
readInto(Binary bytes, java.lang.Object start, java.lang.Object end)
boolean
seekable()
int
skip(int num)
java.lang.Object
unwrap()
Unwrap the object by returning the wrapped value.boolean
writable()
void
write(java.lang.Object arg, java.lang.Object start, java.lang.Object end)
-
Methods inherited from class org.mozilla.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
-
-
-
Method Detail
-
init
@JSConstructor public void init(java.lang.Object arg1, java.lang.Object arg2)
-
readable
@JSFunction public boolean readable()
-
writable
@JSFunction public boolean writable()
-
seekable
@JSFunction public boolean seekable()
-
read
@JSFunction public java.lang.Object read(java.lang.Object limit)
-
readInto
@JSFunction public int readInto(Binary bytes, java.lang.Object start, java.lang.Object end)
-
write
@JSFunction public void write(java.lang.Object arg, java.lang.Object start, java.lang.Object end)
-
flush
@JSFunction public void flush()
-
skip
@JSFunction public int skip(int num)
-
close
@JSFunction public void close()
-
closed
@JSFunction public boolean closed()
-
jsunwrap
@JSFunction("unwrap") public java.lang.Object jsunwrap()
-
getInputStream
@JSGetter public java.lang.Object getInputStream()
-
getOutputStream
@JSGetter public java.lang.Object getOutputStream()
-
unwrap
public java.lang.Object unwrap()
Unwrap the object by returning the wrapped value.- Specified by:
unwrap
in interfaceorg.mozilla.javascript.Wrapper
- Returns:
- a wrapped value
-
getClassName
public java.lang.String getClassName()
Return the name of the class.- Specified by:
getClassName
in interfaceorg.mozilla.javascript.Scriptable
- Specified by:
getClassName
in classorg.mozilla.javascript.ScriptableObject
- Returns:
- the class name
-
-