• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/29

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

29 Cards in this Set

  • Front
  • Back

java class that reads bytes and decodes them into characters.

InputStreamReader

Buffers an InputStreamReader, so you can read in line by line.
BufferedReader

What is the variable name for getting user input?

System.in

takes a text file and converts it into a character stream

FileReader

Writes Characters from stream

FileWriter

Buffers an outputstream, so you can write to it.

BufferedWriter

Reads a binary input stream

FileInputStream

writes a binary stream

FileOutputStream

How do you copy a text file?

FileReader fr = new FileReader("P:\\foo.txt"); BufferedReader br = new BufferedReader(fr); FileWriter fw = new FileWriter("b.txt"); BufferedWriter bw = new BufferedWriter(fw);




String line = null;


while ((line=br.readLine())!=null){ bw.write(line); }

What class do we need to import to do file reads/writes?

java.io.*

How do i set up a java function that may have an error related to reading/writing?

public static void main(String[] args) throws IOException{


}

How do you set up a Socket Server?

try {

ServerSocket server = new ServerSocket(8888);


while (true) {


Socket incoming = server.accept();


// obtain a client socket


// handle client request by reading from and writing to the socket …


}} catch (IOException e)


{ // handle exception on creating a server socket}

How do you set up a Socket Client?

try { Socket s = new Socket(“localhost”, 8888);

// send and receive data by using out and in … } catch (IOException e) { // handle exception …}

What is a Servlet?

Basically, a java program that runs on theserver. It creates dynamic web pages

What does a Servlet need?

1.JavaServer Web Development Kit(JSWDK) E.g., eclipse or Netbeans



2.Servlet capable server (Tomcat is the most common one)




3.Servlet code

What are some examples of servlet servers?

Weblogic, JBoss, Tomcat

What do we need to import to use a servlet?

Javax.servlet.*

JVM means?

Java Virtual Machine

print line to console in java

System.out.println("blah);

type that can be true of false? (exact name in Java)

boolean

class than contains multiple characters? (exact name in Java)

String

declare an array in Java.

int[] foo = new int[333];

When can an array be initialized like so:


int[] values = { 12, 24, -23, 47 };

Only when the variable is declared.

How do i get the total number of elements in a (full) array in Java?

int length = array.length;

How to send some text between socket server and client?

out.println(“Hello!”);

out.flush();

How to read a line from a socket server?

str = in.readLine() ;

How to set up to read write with sockets?

BufferedReader in = new BufferedReader(new InputStreamReader( socket.getInputStream()));



PrintWriter out = new PrintWriter(new OutputStreamWriter( socket.getOutputStream()));

How to get a variable from html in java

String email = request.getParameter("email");

How to get a part in java from html

Part filePart = request.getPart("file");