Skip to content

Commit

Permalink
Added some sdk docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredreichbier committed Jul 20, 2010
1 parent b845645 commit 4ae8d94
Show file tree
Hide file tree
Showing 135 changed files with 8,291 additions and 0 deletions.
190 changes: 190 additions & 0 deletions source/sdk/io/File.rst
@@ -0,0 +1,190 @@
io/File
=======

.. module:: io/File

.. class:: File

:extends: :class:`~lang/types Object`
.. staticmethod:: new (path: :cover:`~lang/types String` ) -> :class:`~io/File File`

.. staticmethod:: new~parentFile (parent: :class:`~io/File File` , path: :cover:`~lang/types String` ) -> :class:`~io/File File`

.. staticmethod:: new~parentPath (parent, path: :cover:`~lang/types String` ) -> :class:`~io/File File`

.. method:: isDir -> :cover:`~lang/types Bool`

:return: true if it's a directory


.. method:: isFile -> :cover:`~lang/types Bool`

:return: true if it's a file (ie. not a directory nor a symbolic link)


.. method:: isLink -> :cover:`~lang/types Bool`

:return: true if the file is a symbolic link


.. method:: size -> :cover:`~lang/types LLong`

:return: the size of the file, in bytes


.. method:: exists -> :cover:`~lang/types Bool`

:return: true if the file exists and can be
opened for reading


.. method:: ownerPerm -> :cover:`~lang/types Int`

:return: the permissions for the owner of this file


.. method:: groupPerm -> :cover:`~lang/types Int`

:return: the permissions for the group of this file


.. method:: otherPerm -> :cover:`~lang/types Int`

:return: the permissions for the others (not owner, not group)


.. method:: name -> :cover:`~lang/types String`

:return: the last part of the path, e.g. for /etc/init.d/bluetooth
name() will return 'bluetooth'


.. method:: parent -> :class:`~io/File File`

:return: the parent of this file, e.g. for /etc/init.d/bluetooth
it will return /etc/init.d/ (as a File), or null if it's the
root directory.


.. method:: parentName -> :cover:`~lang/types String`

:return: the parent of this file, e.g. for /etc/init.d/bluetooth
it will return /etc/init.d/ (as a File), or null if it's the
root directory.


.. method:: mkdir -> :cover:`~lang/types Int`

create a directory at the path specified by this file,
with permissions 0c755 by default


.. method:: mkdir~withMode (mode: :cover:`~lang/types Int32` ) -> :cover:`~lang/types Int`

create a directory at the path specified by this file

:param mode: The permissions at the creation of the directory


.. method:: mkdirs

create a directory at the path specified by this file,
and all the parent directories if needed,
with permissions 0c755 by default


.. method:: mkdirs~withMode (mode: :cover:`~lang/types Int32` ) -> :cover:`~lang/types Int`

create a directory at the path specified by this file,
and all the parent directories if needed

:param mode: The permissions at the creation of the directory


.. method:: lastAccessed -> :cover:`~lang/types Long`

:return: the time of last access


.. method:: lastModified -> :cover:`~lang/types Long`

:return: the time of last modification


.. method:: created -> :cover:`~lang/types Long`

:return: the time of creation


.. method:: isRelative -> :cover:`~lang/types Bool`

:return: true if the function is relative to the current directory


.. method:: getPath -> :cover:`~lang/types String`

the path this file has been created with


.. method:: getAbsolutePath -> :cover:`~lang/types String`

The absolute path, e.g. "my/dir" => "/current/directory/my/dir"


.. method:: getAbsoluteFile -> :class:`~io/File File`

A file corresponding to the absolute path

:see: getAbsolutePath


.. method:: getChildrenNames -> :class:`~structs/ArrayList ArrayList<T>`

List the name of the children of this path
Works only on directories, obviously


.. method:: getChildren -> :class:`~structs/ArrayList ArrayList<T>`

List the children of this path
Works only on directories, obviously


.. method:: remove -> :cover:`~lang/types Int`

Tries to remove the file. This only works for files, not directories.


.. method:: copyTo (dstFile: :class:`~io/File File` )

Copies the content of this file to another

:param dstFile: the file to copy to


.. method:: read -> :cover:`~lang/types String`

.. method:: write~string (str: :cover:`~lang/types String` )

.. method:: write~reader (reader: :class:`~io/Reader Reader` )

.. method:: getChild (name: :cover:`~lang/types String` ) -> :class:`~io/File File`

Get a child of this path

:param name: The name of the child, relatively to this path


.. staticmethod:: getCwd -> :cover:`~lang/types String`

:return: the current working directory


.. field:: MAX_PATH_LENGTH -> :cover:`~lang/types Int`

.. field:: path -> :cover:`~lang/types String`

.. field:: separator -> :cover:`~lang/types Char`

.. field:: pathDelimiter -> :cover:`~lang/types Char`

56 changes: 56 additions & 0 deletions source/sdk/io/FileReader.rst
@@ -0,0 +1,56 @@
io/FileReader
=============

.. module:: io/FileReader

.. function:: fopen (filename, mode: :cover:`~lang/types Char` *) -> :cover:`~lang/stdio FILE` *

.. function:: fread (ptr: :cover:`~lang/types Pointer` , size, count: :cover:`~lang/types SizeT` , stream: :cover:`~lang/stdio FILE` *) -> :cover:`~lang/types SizeT`

.. function:: ferror (stream: :cover:`~lang/stdio FILE` *) -> :cover:`~lang/types Int`

.. function:: feof (stream: :cover:`~lang/stdio FILE` *) -> :cover:`~lang/types Int`

.. function:: fseek (stream: :cover:`~lang/stdio FILE` *, offset: :cover:`~lang/types Long` , origin: :cover:`~lang/types Int` ) -> :cover:`~lang/types Int`

.. function:: ftell (stream: :cover:`~lang/stdio FILE` *) -> :cover:`~lang/types Long`

.. class:: FileReader

:extends: :class:`~io/Reader Reader`
.. staticmethod:: new~withFile (fileObject: :class:`~io/File File` ) -> :class:`~io/FileReader FileReader`

.. method:: init~withFile (fileObject: :class:`~io/File File` )

.. staticmethod:: new~withName (fileName: :cover:`~lang/types String` ) -> :class:`~io/FileReader FileReader`

.. method:: init~withName (fileName: :cover:`~lang/types String` )

.. staticmethod:: new~withMode (fileName, mode: :cover:`~lang/types String` ) -> :class:`~io/FileReader FileReader`

.. method:: init~withMode (fileName, mode: :cover:`~lang/types String` )

.. method:: read (chars: :cover:`~lang/types String` , offset, count: :cover:`~lang/types Int` ) -> :cover:`~lang/types SizeT`

.. method:: read~char -> :cover:`~lang/types Char`

.. method:: readLine -> :cover:`~lang/types String`

.. method:: hasNext -> :cover:`~lang/types Bool`

.. method:: rewind (offset: :cover:`~lang/types Int` )

.. method:: mark -> :cover:`~lang/types Long`

.. method:: reset (marker: :cover:`~lang/types Long` )

.. method:: close

.. field:: file -> :cover:`~lang/stdio FILE` *

.. var:: SEEK_CUR -> :cover:`~lang/types Int`

.. var:: SEEK_SET -> :cover:`~lang/types Int`

.. var:: SEEK_END -> :cover:`~lang/types Int`

36 changes: 36 additions & 0 deletions source/sdk/io/FileWriter.rst
@@ -0,0 +1,36 @@
io/FileWriter
=============

.. module:: io/FileWriter

.. class:: FileWriter

:extends: :class:`~io/Writer Writer`
.. staticmethod:: new~withFile (fileObject: :class:`~io/File File` , append: :cover:`~lang/types Bool` ) -> :class:`~io/FileWriter FileWriter`

.. method:: init~withFile (fileObject: :class:`~io/File File` , append: :cover:`~lang/types Bool` )

.. staticmethod:: new~withFileOverwrite (fileObject: :class:`~io/File File` ) -> :class:`~io/FileWriter FileWriter`

.. method:: init~withFileOverwrite (fileObject: :class:`~io/File File` )

.. staticmethod:: new~withName (fileName: :cover:`~lang/types String` , append: :cover:`~lang/types Bool` ) -> :class:`~io/FileWriter FileWriter`

.. method:: init~withName (fileName: :cover:`~lang/types String` , append: :cover:`~lang/types Bool` )

.. staticmethod:: new~withNameOverwrite (fileName: :cover:`~lang/types String` ) -> :class:`~io/FileWriter FileWriter`

.. method:: init~withNameOverwrite (fileName: :cover:`~lang/types String` )

.. method:: write (chars: :cover:`~lang/types String` , length: :cover:`~lang/types SizeT` ) -> :cover:`~lang/types SizeT`

.. method:: write~chr (chr: :cover:`~lang/types Char` )

.. method:: close

.. method:: writef (fmt: :cover:`~lang/types String` , ...)

.. method:: vwritef (fmt: :cover:`~lang/types String` , args: :cover:`~lang/vararg VaList` )

.. field:: file -> :cover:`~lang/stdio FStream`

32 changes: 32 additions & 0 deletions source/sdk/io/Reader.rst
@@ -0,0 +1,32 @@
io/Reader
=========

.. module:: io/Reader

.. class:: Reader

:extends: :class:`~lang/types Object`
.. method:: read (chars: :cover:`~lang/types String` , offset, count: :cover:`~lang/types Int` ) -> :cover:`~lang/types SizeT`

.. method:: read~char -> :cover:`~lang/types Char`

.. method:: readUntil (end: :cover:`~lang/types Char` ) -> :cover:`~lang/types String`

.. method:: readLine -> :cover:`~lang/types String`

.. method:: peek -> :cover:`~lang/types Char`

.. method:: skipWhile (unwanted: :cover:`~lang/types Char` )

.. method:: hasNext -> :cover:`~lang/types Bool`

.. method:: rewind (offset: :cover:`~lang/types Int` )

.. method:: mark -> :cover:`~lang/types Long`

.. method:: reset (marker: :cover:`~lang/types Long` )

.. method:: skip (offset: :cover:`~lang/types Int` )

.. field:: marker -> :cover:`~lang/types Long`

29 changes: 29 additions & 0 deletions source/sdk/io/Writer.rst
@@ -0,0 +1,29 @@
io/Writer
=========

.. module:: io/Writer

.. class:: Writer

:extends: :class:`~lang/types Object`
.. method:: close

.. method:: write~chr (chr: :cover:`~lang/types Char` )

.. method:: write (chars: :cover:`~lang/types String` , length: :cover:`~lang/types SizeT` ) -> :cover:`~lang/types SizeT`

.. method:: write~implicitLength (chars: :cover:`~lang/types String` ) -> :cover:`~lang/types SizeT`

.. method:: write~fromReader (source: :class:`~io/Reader Reader` , bufferSize: :cover:`~lang/types SizeT` ) -> :cover:`~lang/types SizeT`

Copies data from a Reader into this Writer.

:param bufferSize: size in bytes of the internal transfer buffer
:return: total bytes transfered


.. method:: write~fromReaderDefaultBufferSize (source: :class:`~io/Reader Reader` )

Same as write(source, bufferSize) except uses a default buffer size of 8192 bytes.


0 comments on commit 4ae8d94

Please sign in to comment.