°³¿ä

ÀÌ ¹®¼­´Â XScript¿¡¼­ ÆÄÀÏÀ» ÀÛ¼ºÇÏ´Â ¹æ¹ýÀ» ¼³¸íÇÕ´Ï´Ù.

ÆÄÀÏÀÇ Ãëµæ

ÆÄÀÏÀ» ÀÛ¼ºÇÏ·Á¸é ¸ÕÀú ÆÄÀÏ °´Ã¼¸¦ ¾ò¾î¾ß ÇÕ´Ï´Ù. ÆÄÀÏ °´Ã¼¸¦ ¾ò´Â ¹æ¹ýÀº ´ÙÀ½°ú °°½À´Ï´Ù.

Á÷Á¢ ÆÄÀÏ °´Ã¼ »ý¼º

/*
 * »ó´ë °æ·Î: ½ºÅ©¸³Æ®°¡ ½ÇÇàµÉ ´ë»ó eXERD ÆÄÀÏÀÌ ´ã±ä Æú´õ¿¡ ÆÄÀÏÀ» ¸¸µë
 */
var file = newFile("test.txt");

/*
 * Àý´ë °æ·Î: helloWorld ÇÁ·ÎÁ§Æ® ¾È¿¡ test.txt ÆÄÀÏÀ» ¸¸µë.
 */
var file2 = newFile("/helloWorld/test.txt");

»ç¿ëÀÚ°¡ ÆÄÀÏÀ» ¼±ÅÃÇϵµ·Ï Çϱâ

var file = promptSaveFile();

ÆÄÀÏ ³»¿ë ¾²±â

ÆÄÀÏÀÇ ³»¿ëÀ» ¾²·Á¸é, ÆÄÀÏ °´Ã¼·ÎºÎÅÍ, ¾²±â ½ºÆ®¸² °´Ã¼¸¦ ¾ò¾î¾ß ÇÕ´Ï´Ù. ¾²±â ½ºÆ®¸² °´Ã¼¸¦ ¾ò´Â ¹æ¹ýÀº ´ÙÀ½°ú °°½À´Ï´Ù.

var file = ...;
var outputStream = file.getOutputStream(); // ¾²±â ½ºÆ®¸² ¾ò±â

ÀÏ´Ü ½ºÆ®¸²À» ¾òÀ¸¸é ´ÙÀ½°ú °°ÀÌ ³»¿ëÀ» ¾µ ¼ö ÀÖ½À´Ï´Ù:

var outputStream = ...;

outputStream.printf("%s(%df¼¼)\n", "È«±æµ¿", 32);

ÆÄÀÏÀÇ ³»¿ë:

È«±æµ¿(32¼¼)

¿¹¸¦ µé¾î ¸ðµç Ä÷³ÀÇ À̸§°ú µ¥ÀÌÅÍ Å¸ÀÔÀ» Ãâ·ÂÇÏ´Â ¿¹Á¦´Â ´ÙÀ½°ú °°½À´Ï´Ù:

var outputStream = ...;

select(function(it){
	return it.get("type") == "column";
}).each(function(it){
	outputStream.printf("%s : %s\n", it.get("logical-name"), it.get("data-type"));
});

outputStream.close();