📄 testtracksample.java
字号:
package sql99;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import connections.*;
public class TestTrackSample {
public static void main(String[] args) {
String filename =
chooseFile("Select the file to be stored in the database");
System.out.println("Filename=[" + filename + "]");
TrackSample ts = null;
if (!filename.equals("")) {
File file = new File(filename);
ts = new TrackSample(1, 1, file);
ts.create();
}
filename = chooseFile("Select the file where the binary data " +
"will be written");
System.out.println("Filename=[" + filename + "]");
if (!filename.equals("")) {
File file = new File(filename);
ts = new TrackSample(1, 1, file);
ts.retrieve();
}
System.exit(0);
}
static String chooseFile(String title) {
// Use a JFileChooser to let the user select the file to be
// read and written to the media table
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(title);
int returnVal = chooser.showOpenDialog(null);
String pathname = "";
if (returnVal == JFileChooser.APPROVE_OPTION) {
pathname = chooser.getSelectedFile().getAbsolutePath();
} else {
System.out.println("No file selected");
}
chooser = null;
return pathname;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -