Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unix File Interface int open(const char* path, int flags, mode_t permissions); ssize_t read(int fd, void* buffer, size_t count); ssize_t write(int fd,

Similar presentations


Presentation on theme: "Unix File Interface int open(const char* path, int flags, mode_t permissions); ssize_t read(int fd, void* buffer, size_t count); ssize_t write(int fd,"— Presentation transcript:

1 Unix File Interface int open(const char* path, int flags, mode_t permissions); ssize_t read(int fd, void* buffer, size_t count); ssize_t write(int fd, const void* buffer, size_t count); off_t lseek(int fd, off_t offset, int referencePosition); int close(int fd);

2 CS 190 Lecture Notes: Modular Design
Shallow Methods private void addNullValueForAttribute(String attribute) { data.put(attribute, "null"); } /* Updates the persistent data structures to reflect * the given friendship */ private void persist(FriendshipOp f) { recordStore.append(friendFile, f); CS 190 Lecture Notes: Modular Design

3 CS 190 Lecture Notes: Modular Design
Java I/O FileInputStream fileStream = new FileInputStream(fileName); BufferedInputStream bufferedStream = new BufferedInputStream(fileStream); ObjectInputStream objectStream = new ObjectInputStream(bufferedStream); CS 190 Lecture Notes: Modular Design

4 Interface for Text Class
Special-purpose: void backspace(Cursor cursor); void delete(Cursor cursor); void deleteSelection(Selection selection); General-purpose: void insert(Position position, String newText); void delete(Position start, Position end); Position changePosition(Position position, int numChars); CS 190 Lecture Notes: Modular Design

5 CS 190 Lecture Notes: Modular Design
Pass-Through Methods public class TextDocument ... { private TextArea textArea; private WeakReference<TextDocumentListener> listener; ... public Character getLastTypedCharacter() { return textArea.getLastTypedCharacter(); } public int getCursorOffset() { return textArea.getCursorOffset(); public void insertString(String textToInsert, int offset) { textArea.insertText(textToInsert, offset); public void willInsertString(String stringToInsert, int offset) { if (listener != null && listener.get() != null) { listener.get().willInsertString(this, stringToInsert, offset); CS 190 Lecture Notes: Modular Design

6 CS 190 Lecture Notes: Modular Design
UNIX ioctl int result = ioctl(int fd, int request, void* inBuffer, int inputSize, void* outBuffer, int outputSize); CS 190 Lecture Notes: Modular Design


Download ppt "Unix File Interface int open(const char* path, int flags, mode_t permissions); ssize_t read(int fd, void* buffer, size_t count); ssize_t write(int fd,"

Similar presentations


Ads by Google