Module org.htmlunit

Class FileReader

java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
org.htmlunit.corejs.javascript.ScriptableObject
All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

public class FileReader extends EventTarget
A JavaScript object for FileReader.
Author:
Ahmed Ashour, Ronald Brill, Lai Quang Duong
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The entire read request has been completed.
    static final int
    No data has been loaded yet.
    static final int
    Data is currently being loaded.

    Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    CONST, DONTENUM, PERMANENT, READONLY, UNINITIALIZED_CONST

    Fields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    isSealed

    Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

    NOT_FOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.htmlunit.corejs.javascript.Function
    Returns the onerror event handler for this FileReader.
    org.htmlunit.corejs.javascript.Function
    Returns the onload event handler for this FileReader.
    org.htmlunit.corejs.javascript.Function
    Returns the onloadend event handler for this FileReader.
    org.htmlunit.corejs.javascript.Function
    Returns the onloadstart event handler for this FileReader.
    org.htmlunit.corejs.javascript.Function
    Returns the onprogress event handler for this FileReader.
    int
    Returns the current state of the reading operation.
    Returns the file's contents.
    void
    JavaScript constructor.
    void
    Reads the contents of the specified Blob or File.
    void
    Reads the contents of the specified Blob or File.
    void
    readAsText(Object object, Object encoding)
    Reads the contents of the specified Blob or File.
    void
    setOnerror(Object onerror)
    Sets the onerror event handler for this FileReader.
    void
    setOnload(Object onload)
    Sets the onload event handler for this FileReader.
    void
    setOnloadend(Object onloadend)
    Sets the onloadend event handler for this FileReader.
    void
    setOnloadstart(Object onloadstart)
    Sets the onloadstart event handler for this FileReader.
    void
    setOnprogress(Object onprogress)
    Sets the onprogress event handler for this FileReader.

    Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    applyDescriptorToAttributeBitset, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, get, get, getAllIds, getAncestor, getArrayPrototype, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getThis, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasProperty, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isTrue, preventExtensions, put, put, putConst, putConstProperty, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, redefineProperty, sameValue, sealObject, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size

    Methods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, defineProperty, defineProperty, get, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getIds, has, has, isSealed, readMaps, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, writeMaps

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.htmlunit.corejs.javascript.Scriptable

    get, getIds, has, has

    Methods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable

    get, has
  • Field Details

    • EMPTY

      public static final int EMPTY
      No data has been loaded yet.
      See Also:
    • LOADING

      public static final int LOADING
      Data is currently being loaded.
      See Also:
    • DONE

      public static final int DONE
      The entire read request has been completed.
      See Also:
  • Constructor Details

    • FileReader

      public FileReader()
  • Method Details

    • jsConstructor

      public void jsConstructor()
      JavaScript constructor.
      Overrides:
      jsConstructor in class EventTarget
    • getReadyState

      public int getReadyState()
      Returns the current state of the reading operation.
      Returns:
      0, 1, or 2
    • getResult

      public Object getResult()
      Returns the file's contents.
      Returns:
      the file's contents
    • readAsDataURL

      public void readAsDataURL(Object object) throws IOException
      Reads the contents of the specified Blob or File.
      Parameters:
      object - the Blob or File from which to read
      Throws:
      IOException - if an error occurs
    • readAsArrayBuffer

      public void readAsArrayBuffer(Object object)
      Reads the contents of the specified Blob or File.
      Parameters:
      object - the Blob or File from which to read
    • readAsText

      public void readAsText(Object object, Object encoding)
      Reads the contents of the specified Blob or File. When the read operation is complete, the readyState is changed to DONE, the loaded event is triggered, and the result attribute contains the contents of the file as a text string.
      Parameters:
      object - the Blob or File from which to read
      encoding - the encoding
    • getOnloadstart

      public org.htmlunit.corejs.javascript.Function getOnloadstart()
      Returns the onloadstart event handler for this FileReader.
      Returns:
      the onloadstart event handler for this FileReader
    • setOnloadstart

      public void setOnloadstart(Object onloadstart)
      Sets the onloadstart event handler for this FileReader.
      Parameters:
      onloadstart - the onloadstart event handler for this FileReader
    • getOnprogress

      public org.htmlunit.corejs.javascript.Function getOnprogress()
      Returns the onprogress event handler for this FileReader.
      Returns:
      the onprogress event handler for this FileReader
    • setOnprogress

      public void setOnprogress(Object onprogress)
      Sets the onprogress event handler for this FileReader.
      Parameters:
      onprogress - the onprogress event handler for this FileReader
    • getOnload

      public org.htmlunit.corejs.javascript.Function getOnload()
      Returns the onload event handler for this FileReader.
      Returns:
      the onload event handler for this FileReader
    • setOnload

      public void setOnload(Object onload)
      Sets the onload event handler for this FileReader.
      Parameters:
      onload - the onload event handler for this FileReader
    • getOnloadend

      public org.htmlunit.corejs.javascript.Function getOnloadend()
      Returns the onloadend event handler for this FileReader.
      Returns:
      the onloadend event handler for this FileReader
    • setOnloadend

      public void setOnloadend(Object onloadend)
      Sets the onloadend event handler for this FileReader.
      Parameters:
      onloadend - the onloadend event handler for this FileReader
    • getOnerror

      public org.htmlunit.corejs.javascript.Function getOnerror()
      Returns the onerror event handler for this FileReader.
      Returns:
      the onerror event handler for this FileReader
    • setOnerror

      public void setOnerror(Object onerror)
      Sets the onerror event handler for this FileReader.
      Parameters:
      onerror - the onerror event handler for this FileReader