ML4SE23
Collection
Collection of models for the course. Naming convention: ML4SE23_G{group_number}_{model_name} • 27 items • Updated • 2
function_id_one float64 44.9k 21.2M ⌀ | function_one stringlengths 114 15.1k ⌀ | function_id_two float64 81.3k 23.7M ⌀ | function_two stringlengths 134 11.3k ⌀ | functionality_type stringclasses 18
values | big_clone_types stringclasses 1
value | is_clone bool 2
classes |
|---|---|---|---|---|---|---|
1,184,290 | @Override
public void execute () {
File currentModelDirectory = new File (this.globalData.getData (String.class, GlobalData.MODEL_INSTALL_DIRECTORY));
File mobileDirectory = new File (currentModelDirectory, "mobile");
mobileDirectory.mkdir ();
File mobileModelFile = new File (mobileDirectory, "mobile_mo... | 23,247,094 | void copyZipToZip (ZipInputStream zis, ZipOutputStream zos) throws Exception {
ZipEntry entry;
byte [] buffer = new byte [1];
while ((entry = zis.getNextEntry ()) != null) {
zos.putNextEntry (new ZipEntry (entry.getName ()));
while (zis.available () == 1) {
zis.read (buffer, 0, b... | Zip Files | Type-3 (WT3/4) | false |
3,596,849 | private static void solve_l1r_l2_svc (Problem prob_col, double [] w, double eps, double Cp, double Cn) {
int l = prob_col.l;
int w_size = prob_col.n;
int j, s, iter = 0;
int max_iter = 1000;
int active_size = w_size;
int max_num_linesearch = 20;
double sigma = 0.01;
double d, G_loss, G, ... | 8,533,735 | public void shuffle () {
Card tempCard = new Card ();
for (int i = 0;
i < NUM_CARDS; i ++) {
int j = i + r.nextInt (NUM_CARDS - i);
tempCard = cards [j];
cards [j] = cards [i];
cards [i] = tempCard;
}
position = 0;
}
| Shuffle Array in Place | Type-3 (WT3/4) | false |
469,518 | public synchronized void writeFile (String filename) throws IOException {
int amount;
byte buffer [] = new byte [4096];
File f = new File (filename);
FileInputStream in = new FileInputStream (f);
putNextEntry (new ZipEntry (f.getName ()));
while ((amount = in.read (buffer)) != - 1) write (buffer... | 21,524,576 | private static void zip (File srcDir, File originSrcDir, ZipOutputStream dstStream) throws IOException {
byte [] buffer = new byte [ZIP_BUFFER_SIZE];
int bytes = 0;
String [] dirList = srcDir.list ();
for (int i = 0;
i < dirList.length; i ++) {
File file = new File (srcDir, dirList [i]);
... | Zip Files | Type-3 (WT3/4) | false |
1,282,532 | void initOut () throws IOException {
if (zipped) {
zout = new ZipOutputStream (sink);
zout.putNextEntry (new ZipEntry ("file.xml"));
this.xout = new OutputStreamWriter (zout, "UTF8");
} else {
this.xout = new OutputStreamWriter (sink, "UTF8");
}
}
| 13,877,913 | public static boolean addZipEntry (String srcZipFile, String newEntryFile, String dstFile) {
java.util.zip.ZipOutputStream zout = null;
InputStream is = null;
try {
if (new File (newEntryFile).isDirectory () && ! newEntryFile.substring (newEntryFile.length () - 1).equals (File.separator)) {
... | Zip Files | Type-3 (WT3/4) | false |
4,932,279 | public void testSavepoint4 () throws Exception {
Statement stmt = con.createStatement ();
stmt.execute ("CREATE TABLE #savepoint4 (data int)");
stmt.close ();
con.setAutoCommit (false);
for (int i = 0;
i < 3; i ++) {
PreparedStatement pstmt = con.prepareStatement ("INSERT INTO #savepoint... | 19,147,301 | public boolean actualizarIdPartida (int idJugadorDiv, int idRonda, int idPartida) {
int intResult = 0;
String sql = "UPDATE jugadorxdivxronda " + " SET idPartida = " + idPartida + " WHERE jugadorxDivision_idJugadorxDivision = " + idJugadorDiv + " AND ronda_numeroRonda = " + idRonda;
try {
connection... | Execute update and rollback. | Type-3 (WT3/4) | true |
1,023,289 | public static String MD5 (String s) {
try {
MessageDigest m = MessageDigest.getInstance ("MD5");
m.update (s.getBytes (), 0, s.length ());
return new BigInteger (1, m.digest ()).toString (16);
} catch (NoSuchAlgorithmException ex) {
return "";
}
}
| 14,032,835 | private byte [] szyfrujKlucz (byte [] kluczSesyjny) {
byte [] zaszyfrowanyKlucz = null;
byte [] klucz = null;
try {
MessageDigest skrot = MessageDigest.getInstance ("SHA-1");
skrot.update (haslo.getBytes ());
byte [] skrotHasla = skrot.digest ();
Object kluczDoKlucza = MARS_A... | Secure Hash | Type-3 (WT3/4) | true |
1,287,483 | protected void doGet (HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException {
keysString = req.getParameter ("resultKeys");
if (req.getParameter ("mode") != null && ! req.getParameter ("mode").equals ("")) {
archiveHelper.setMode (req.getParameter ("mode"));
}
... | 18,643,979 | private static void addTargetFile (ZipOutputStream zos, File file) throws FileNotFoundException, ZipException, IOException {
try {
BufferedInputStream bis = new BufferedInputStream (new FileInputStream (file));
String file_path = file.getPath ();
if (file_path.startsWith (OctopusApplication.... | Zip Files | Type-3 (WT3/4) | false |
4,140,310 | public boolean verify (final char [] password, final String encryptedPassword) {
MessageDigest digest = null;
int size = 0;
String base64 = null;
if (encryptedPassword.regionMatches (true, 0, "{SHA}", 0, 5)) {
size = 20;
base64 = encryptedPassword.substring (5);
try {
... | 6,659,731 | public static String hashStringMD5 (String string) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance ("MD5");
md.update (string.getBytes ());
byte byteData [] = md.digest ();
StringBuffer sb = new StringBuffer ();
for (int i = 0;
i < byteData.length; i ++) {
... | Secure Hash | Type-3 (WT3/4) | true |
945,981 | private void displayDiffResults () throws IOException {
File outFile = File.createTempFile ("diff", ".htm");
outFile.deleteOnExit ();
FileOutputStream outStream = new FileOutputStream (outFile);
BufferedWriter out = new BufferedWriter (new OutputStreamWriter (outStream));
out.write ("<html><head><ti... | 12,523,607 | public void render (ServiceContext serviceContext) throws Exception {
if (serviceContext.getTemplateName () == null) throw new Exception ("no Template defined for service: " + serviceContext.getServiceInfo ().getRefName ());
File f = new File (serviceContext.getTemplateName ());
serviceContext.getResponse ... | Copy File | Type-3 (WT3/4) | true |
1,951,108 | private void zipStream (InputStream inStream, String streamName, File zipFile) throws IOException {
if (inStream == null) {
log.warn ("No stream to zip.");
} else {
try {
FileOutputStream dest = new FileOutputStream (zipFile);
ZipOutputStream out = new ZipOutputStream (ne... | 14,787,145 | public void setVariables (Properties varDef) throws Exception {
sendMsg ("Setting the variables ...");
outJar.putNextEntry (new ZipEntry ("vars"));
ObjectOutputStream objOut = new ObjectOutputStream (outJar);
objOut.writeObject (varDef);
objOut.flush ();
outJar.closeEntry ();
}
| Zip Files | Type-3 (WT3/4) | false |
1,121,468 | private static PrintWriter getOut (int first, int last, String dir, String lang) throws IOException {
if (dir == null) return null;
File file = new File (dir, lang + ".wikipedia.zip");
if (! file.exists ()) file.createNewFile ();
if (! file.canWrite ()) throw new IllegalArgumentException ("can't write... | 23,160,103 | public void writeJar (JarOutputStream out) throws IOException, Pack200Exception {
String [] fileName = fileBands.getFileName ();
int [] fileModtime = fileBands.getFileModtime ();
long [] fileSize = fileBands.getFileSize ();
byte [] [] fileBits = fileBands.getFileBits ();
int classNum = 0;
int nu... | Zip Files | Type-3 (WT3/4) | false |
850,680 | private static void readAndRewrite (File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream (new BufferedInputStream (new FileInputStream (inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance ().newDcmParser (iis);
Dataset ds = DcmObjectFactory.getInsta... | 3,024,971 | @Test
public void testCopy_inputStreamToOutputStream_nullIn () throws Exception {
OutputStream out = new ByteArrayOutputStream ();
try {
IOUtils.copy ((InputStream) null, out);
fail ();
} catch (NullPointerException ex) {
}
}
| Copy File | Type-3 (WT3/4) | true |
337,322 | static void copy (String src, String dest) throws IOException {
File ifp = new File (src);
File ofp = new File (dest);
if (ifp.exists () == false) {
throw new IOException ("file '" + src + "' does not exist");
}
FileInputStream fis = new FileInputStream (ifp);
FileOutputStream fos = new ... | 12,859,344 | private void sendFile (File file, HttpServletResponse response) throws IOException {
response.setContentLength ((int) file.length ());
InputStream inputStream = null;
try {
inputStream = new FileInputStream (file);
IOUtils.copy (inputStream, response.getOutputStream ());
} finally {
... | Copy File | Type-3 (WT3/4) | true |
1,282,532 | void initOut () throws IOException {
if (zipped) {
zout = new ZipOutputStream (sink);
zout.putNextEntry (new ZipEntry ("file.xml"));
this.xout = new OutputStreamWriter (zout, "UTF8");
} else {
this.xout = new OutputStreamWriter (sink, "UTF8");
}
}
| 16,062,997 | public static boolean zipDirectoryRecursive (File path, File zipFileName, String excludeRegEx, boolean relative, boolean compress) {
ArrayList < File > filesToZip = new ArrayList < File > ();
if (path.exists ()) {
File [] files = path.listFiles ();
for (int i = 0;
i < files.length; i ++)... | Zip Files | Type-3 (WT3/4) | false |
6,961,676 | public void actionPerformed (ActionEvent e) {
if (SAVEPICTURE.equals (e.getActionCommand ())) {
byte [] data = ((PicturePane) picturesPane.getSelectedComponent ()).getImage ();
if (data == null) {
return;
}
File f = Util.getFile (this, "Save file", true);
if (f !=... | 8,954,798 | public static void writeProject (ProjectModel projectModel, String path) throws IOException {
log.info ("Writing project file to " + path);
File file = JDemResourceLoader.getAsFile (path);
ZipOutputStream zos = new ZipOutputStream (new BufferedOutputStream (new FileOutputStream (file)));
ZipEntry settin... | Zip Files | Type-3 (WT3/4) | true |
5,389,884 | public static long getDummyCRC (long count) throws IOException {
CRC32 crc = new CRC32 ();
byte [] data = new byte [1024];
int done = 0;
while (done < count) {
int tbw = (int) Math.min (count - done, data.length);
crc.update (data, 0, tbw);
done += tbw;
}
return crc.getVa... | 8,849,605 | public void decode (File input) throws DecoderException {
try {
YEncFile yencFile = new YEncFile (input);
StringBuffer outputName = new StringBuffer (outputDirName);
outputName.append (File.separator);
outputName.append (yencFile.getHeader ().getName ());
RandomAccessFile out... | CRC32 File Checksum | Type-3 (WT3/4) | false |
6,168,797 | public byte [] buildPacket (int padding, SecureRandom random) {
byte [] packet = new byte [PACKET_SIZE + padding];
byte [] buffer = m_buffer.getBytes ();
if (random != null) {
random.nextBytes (packet);
} else {
for (int i = 10 + buffer.length;
i < packet.length; i ++) {
... | 8,653,093 | public static boolean decode (String fileName, ByteArrayOutputStream bos) throws IOException {
byte [] buffer = new byte [BUFFERSIZE];
int bufferLength = 0;
BufferedReader file = new BufferedReader (new InputStreamReader (new FileInputStream (fileName)));
String line = file.readLine ();
while (line ... | CRC32 File Checksum | Type-3 (WT3/4) | false |
5,936,119 | public boolean batchFinished () throws Exception {
Instances data = getInputFormat ();
if (data == null) throw new IllegalStateException ("No input instance format defined");
if (m_Converter == null) {
int [] randomIndices = new int [m_ClassCounts.length];
for (int i = 0;
i < random... | 16,380,022 | public void shuffle (Random rand) {
for (int i = cards.length - 1;
i >= 0; i --) {
int r = rand.nextInt (i + 1);
Card t = cards [i];
cards [i] = cards [r];
cards [r] = t;
}
nextCard = 0;
}
| Shuffle Array in Place | Type-3 (WT3/4) | false |
150,036 | public static long compute (String str) {
CRC32 crc = new CRC32 ();
Adler32 adler = new Adler32 ();
crc.update (str.getBytes ());
adler.update (str.getBytes ());
long dg1 = crc.getValue ();
long dg2 = adler.getValue ();
crc.update (String.valueOf (dg2).getBytes ());
adler.update (String.... | 10,905,580 | public String getID () {
CRC32 checksum = new CRC32 ();
int i = 0;
checksum.reset ();
while ((i < data.length ()) && (i < 5000)) {
checksum.update ((int) data.charAt (i));
i ++;
}
return (Long.toHexString (checksum.getValue ()) + Integer.toHexString (data.hashCode ()));
}
| CRC32 File Checksum | Type-3 (WT3/4) | false |
1,262,021 | public void execute () throws BuildException {
boolean manifestFound = false;
ZipFile zipFile = null;
ZipInputStream zipInputStream = null;
ZipOutputStream zipFileOutputStream = null;
FileInputStream fileInputStream = null;
File fileIn = new File (m_jarPath);
if (! fileIn.exists ()) {
... | 1,669,328 | public static byte [] zipEntriesAndFiles (Map < ZipEntry, byte [] > files) throws Exception {
ByteArrayOutputStream dest = new ByteArrayOutputStream ();
ZipOutputStream out = new ZipOutputStream (new BufferedOutputStream (dest));
byte [] data = new byte [2048];
Iterator < ZipEntry > itr = files.keySet (... | Zip Files | Type-3 (WT3/4) | false |
606,859 | private static void readAndRewrite (File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream (new BufferedInputStream (new FileInputStream (inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance ().newDcmParser (iis);
Dataset ds = DcmObjectFactory.getInsta... | 21,834,878 | protected void renderResource (final HttpServletRequest request, final HttpServletResponse response, final InputStream is) throws IOException {
try {
IOUtils.copy (is, response.getOutputStream ());
} finally {
IOUtils.closeQuietly (is);
}
}
| Copy File | Type-3 (WT3/4) | true |
1,446,727 | private void backupDiskFile (ZipOutputStream out, String fileName, DiskFile file) throws SQLException, IOException {
Database db = session.getDatabase ();
fileName = FileUtils.getFileName (fileName);
out.putNextEntry (new ZipEntry (fileName));
int pos = - 1;
int max = file.getReadCount ();
while... | 16,900,371 | private void addAllUploadedFiles (Environment en, ZipOutputStream zipout, int progressStart, int progressLength) throws IOException, FileNotFoundException {
File uploadPath = en.uploadPath (virtualWiki, "");
String [] files = uploadPath.list ();
int bytesRead = 0;
byte byteArray [] = new byte [4096];
... | Zip Files | Type-3 (WT3/4) | false |
732,800 | public BufferedWriter createOutputStream (String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char [] buf = new char [k_blockSize];
File ofp = new File (outFile);
ZipOutputStream zos = new ZipOutputStream (new FileOutputStream (ofp));
zos.setMethod (ZipOutp... | 6,973,739 | private void writeManifestEntry (File f, JarOutputStream out) {
byte [] buffer = new byte [BUFFERSIZE];
int bytes_read;
try {
BufferedInputStream in = new BufferedInputStream (new FileInputStream (f), BUFFERSIZE);
String en = "META-INF" + "/" + "MANIFEST.MF";
out.putNextEntry (new Zi... | Zip Files | Type-3 (WT3/4) | false |
6,368,468 | boolean copyFileStructure (File oldFile, File newFile) {
if (oldFile == null || newFile == null) return false;
File searchFile = newFile;
do {
if (oldFile.equals (searchFile)) return false;
searchFile = searchFile.getParentFile ();
} while (searchFile != null);
if (oldFile.isDirect... | 8,625,346 | public static boolean encodeFileToFile (String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream (new java.io.BufferedInputStream (new java.io.FileInputStream (infile)), Base64.ENCODE);
out... | Copy File | Type-3 (WT3/4) | true |
1,514,106 | private void exportLearningUnitView (File selectedFile) {
if (learningUnitViewElementsManager.isOriginalElementsOnly ()) {
String [] elementIds = learningUnitViewElementsManager.getAllLearningUnitViewElementIds ();
for (int i = 0;
i < elementIds.length; i ++) {
FSLLearningUnitVie... | 7,577,030 | private void zipFiles (File file, File [] fa) throws Exception {
File f = new File (file, ALL_FILES_NAME);
if (f.exists ()) {
f.delete ();
f = new File (file, ALL_FILES_NAME);
}
ZipOutputStream zoutstrm = new ZipOutputStream (new FileOutputStream (f));
for (int i = 0;
i < fa.leng... | Zip Files | Type-3 (WT3/4) | false |
1,579,007 | private void nextZipEntry (String url, int level) throws IOException {
if (! url.startsWith ("META-INF/") && ! url.startsWith ("OEBPS/")) url = "OEBPS/" + url;
ZipEntry ze = new ZipEntry (url);
ze.setMethod (ZipEntry.DEFLATED);
tmpzos.putNextEntry (ze);
}
| 22,055,554 | protected void addFileToJar (JarOutputStream jStream, File inputFile, String logicalFilename) throws BuildException {
FileInputStream iStream = null;
try {
if (! addedfiles.contains (logicalFilename)) {
iStream = new FileInputStream (inputFile);
ZipEntry zipEntry = new ZipEntry (... | Zip Files | Type-3 (WT3/4) | false |
9,275,622 | private boolean copyFile (File _file1, File _file2) {
FileInputStream fis;
FileOutputStream fos;
try {
fis = new FileInputStream (_file1);
fos = new FileOutputStream (_file2);
FileChannel canalFuente = fis.getChannel ();
canalFuente.transferTo (0, canalFuente.size (), fos.get... | 12,312,915 | public static void entering (String [] args) throws IOException, CodeCheckException {
ClassWriter writer = new ClassWriter ();
writer.readClass (new BufferedInputStream (new FileInputStream (args [0])));
int constantIndex = writer.getStringConstantIndex ("Entering ");
int fieldRefIndex = writer.getRefer... | Copy File | Type-3 (WT3/4) | true |
418,257 | public BufferedWriter createOutputStream (String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char [] buf = new char [k_blockSize];
File ofp = new File (outFile);
ZipOutputStream zos = new ZipOutputStream (new FileOutputStream (ofp));
zos.setMethod (ZipOutp... | 10,620,258 | private void writeFileToZip (ZipOutputStream out, String sourceFilename, String vPath) throws IOException {
FileInputStream in = new FileInputStream (sourceFilename);
out.putNextEntry (new ZipEntry (vPath));
int len;
byte [] buf = new byte [1024];
while ((len = in.read (buf)) > 0) {
out.writ... | Zip Files | Type-3 (WT3/4) | false |
268,806 | public void convert (File src, File dest) throws IOException {
InputStream in = new BufferedInputStream (new FileInputStream (src));
DcmParser p = pfact.newDcmParser (in);
Dataset ds = fact.newDataset ();
p.setDcmHandler (ds.getDcmHandler ());
try {
FileFormat format = p.detectFileFormat ();... | 17,296,395 | public static File copyToLibDirectory (final File file) throws FileNotFoundException, IOException {
if (file == null || ! file.exists ()) {
throw new FileNotFoundException ();
}
File directory = new File ("lib/");
File dest = new File (directory, file.getName ());
File parent = dest.getParen... | Copy File | Type-3 (WT3/4) | true |
418,257 | public BufferedWriter createOutputStream (String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char [] buf = new char [k_blockSize];
File ofp = new File (outFile);
ZipOutputStream zos = new ZipOutputStream (new FileOutputStream (ofp));
zos.setMethod (ZipOutp... | 23,309,807 | public OCFContainerWriter (OutputStream out, String mime) throws IOException {
zip = new ZipOutputStream (out);
try {
byte [] bytes = mime.getBytes ("UTF-8");
ZipEntry mimetype = new ZipEntry ("mimetype");
mimetype.setMethod (ZipOutputStream.STORED);
mimetype.setSize (bytes.lengt... | Zip Files | Type-3 (WT3/4) | false |
2,049,240 | private void writeInfos () throws IOException {
zos.putNextEntry (new ZipEntry ("info.bin"));
outFile = new DataOutputStream (zos);
outFile.writeInt (VERSION);
outFile.writeInt (MINORVERSION);
outFile.writeDouble (intervall_s);
zos.closeEntry ();
}
| 22,572,311 | public static byte [] zipFiles (Map < String, byte [] > files) throws IOException {
ByteArrayOutputStream dest = new ByteArrayOutputStream ();
ZipOutputStream out = new ZipOutputStream (new BufferedOutputStream (dest));
Iterator < Entry < String, byte [] > > itr = files.entrySet ().iterator ();
while (i... | Zip Files | Type-3 (WT3/4) | false |
3,266,833 | public MotixFileItem (final InputStream is, final String name, final String contentType, final int index) throws IOException {
this.name = name;
this.contentType = contentType;
this.index = index;
this.extension = FilenameUtils.getExtension (this.name);
this.isImage = ImageUtils.isImage (name);
... | 18,400,649 | public static void copyFiles (String strPath, String dstPath) throws IOException {
File src = new File (strPath);
File dest = new File (dstPath);
if (src.isDirectory ()) {
dest.mkdirs ();
String list [] = src.list ();
for (int i = 0;
i < list.length; i ++) {
if (l... | Copy File | Type-3 (WT3/4) | true |
7,209,802 | public static void main (String [] args) throws IOException {
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket (4444);
} catch (IOException e) {
System.err.println ("Could not listen on port: 4444.");
System.exit (1);
}
Socket clientSocket = null;
t... | 12,440,171 | public void writeFile (String resource, InputStream is) throws IOException {
File f = prepareFsReferenceAsFile (resource);
FileOutputStream fos = new FileOutputStream (f);
BufferedOutputStream bos = new BufferedOutputStream (fos);
try {
IOUtils.copy (is, bos);
} finally {
IOUtils.clo... | Copy File | Type-3 (WT3/4) | true |
12,819,863 | public static String generatePassword (String userKey, int applicationId, String applicationKey) {
String nonce = generateNonce ();
String createDate = fmtDate.format (new Date ());
String keyDigest = null;
MessageDigest sha1 = null;
try {
sha1 = MessageDigest.getInstance ("SHA1");
s... | 22,915,885 | public Login authenticateClient () {
Object o;
String user, password;
Vector < Login > clientLogins = ClientLoginsTableModel.getClientLogins ();
Login login = null;
try {
socket.setSoTimeout (25000);
objectOut.writeObject ("JFRITZ SERVER 1.1");
objectOut.flush ();
o =... | Secure Hash | Type-3 (WT3/4) | true |
891,054 | public Thread transmitThread (final Socket s, final CountDownLatch abortLatch) {
final Thread theThread = new Thread () {
@Override
public void run () {
final Random r = new Random ();
final Counter counter = new Counter ("TRANSMIT", plotter);
counter.start ();
... | 1,302,030 | private static String getUnicodeStringIfOriginalMatches (AbstractUnicodeExtraField f, byte [] orig) {
if (f != null) {
CRC32 crc32 = new CRC32 ();
crc32.update (orig);
long origCRC32 = crc32.getValue ();
if (origCRC32 == f.getNameCRC32 ()) {
try {
return Z... | CRC32 File Checksum | Type-3 (WT3/4) | false |
16,319,456 | @Override
public List < SectionFinderResult > lookForSections (String text, Section < ? > father, Type type) {
ArrayList < SectionFinderResult > result = new ArrayList < SectionFinderResult > ();
Pattern TABLE_LINE = Pattern.compile (TABLE_LINE_REGEXP, Pattern.MULTILINE);
Matcher m = TABLE_LINE.matcher (tex... | 19,047,757 | public LinkedList < SearchResult > search (String strRequest) {
LinkedList < SearchResult > ret = new LinkedList < SearchResult > ();
HttpClient h = new HttpClient ();
try {
String strRequestUrl = "http://www.youporn.com/search";
if (strRequest.toLowerCase ().contains ("straight!")) {
... | Extract Matches Using Regex | Type-3 (WT3/4) | true |
7,990,229 | public static InputStream gunzip (final InputStream inputStream) throws IOException {
Assert.notNull (inputStream, "inputStream");
GZIPInputStream gzipInputStream = new GZIPInputStream (inputStream);
InputOutputStream inputOutputStream = new InputOutputStream ();
IOUtils.copy (gzipInputStream, inputOutp... | 15,520,770 | public void writeConfigurationFile () throws IOException, ComponentException {
SystemConfig config = parent.getParentSystem ().getConfiguration ();
File original = config.getLocation ();
File backup = new File (original.getParentFile (), original.getName () + "." + System.currentTimeMillis ());
FileInpu... | Copy File | Type-3 (WT3/4) | true |
1,086,128 | public void streamDataToZip (VolumeTimeSeries vol, ZipOutputStream zout) throws Exception {
ZipEntry entry = new ZipEntry (vol.getId () + ".dat");
zout.putNextEntry (entry);
if (vol instanceof FloatVolumeTimeSeries) {
streamData (((FloatVolumeTimeSeries) vol).getData (), zout);
} else if (vol in... | 13,374,130 | private void zipLog (InfoRolling info) {
boolean zipped = false;
File [] logFiles = info.getFiles ();
try {
GregorianCalendar gc = (GregorianCalendar) GregorianCalendar.getInstance ();
gc.roll (Calendar.DAY_OF_MONTH, info.getBackRolling ());
final String prefixFileName = logFileName.... | Zip Files | Type-3 (WT3/4) | false |
9,371,509 | public SWORDEntry ingestDepost (final DepositCollection pDeposit, final ServiceDocument pServiceDocument) throws SWORDException {
try {
ZipFileAccess tZipFile = new ZipFileAccess (super.getTempDir ());
LOG.debug ("copying file");
String tZipTempFileName = super.getTempDir () + "uploaded-file... | 19,687,456 | public void testReadPerMemberSixSmall () throws IOException {
GZIPMembersInputStream gzin = new GZIPMembersInputStream (new ByteArrayInputStream (sixsmall_gz));
gzin.setEofEachMember (true);
for (int i = 0;
i < 3; i ++) {
int count2 = IOUtils.copy (gzin, new NullOutputStream ());
assertE... | Copy File | Type-3 (WT3/4) | true |
1,579,007 | private void nextZipEntry (String url, int level) throws IOException {
if (! url.startsWith ("META-INF/") && ! url.startsWith ("OEBPS/")) url = "OEBPS/" + url;
ZipEntry ze = new ZipEntry (url);
ze.setMethod (ZipEntry.DEFLATED);
tmpzos.putNextEntry (ze);
}
| 10,178,914 | private void writeEntry (File file, ZipOutputStream output, File oya) throws IOException {
BufferedInputStream input = new BufferedInputStream (new FileInputStream (file));
String fn = extractRelativeZipPath (file.getAbsolutePath (), oya.getAbsolutePath ());
ZipEntry entry = new ZipEntry (this.convertZipEnt... | Zip Files | Type-3 (WT3/4) | false |
792,644 | private static void readAndRewrite (File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream (new BufferedInputStream (new FileInputStream (inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance ().newDcmParser (iis);
Dataset ds = DcmObjectFactory.getInsta... | 7,119,938 | public void putFile (CompoundName file, FileInputStream fileInput) throws IOException {
File fullDir = new File (REMOTE_BASE_DIR.getCanonicalPath ());
for (int i = 0;
i < file.size () - 1; i ++) fullDir = new File (fullDir, file.get (i));
fullDir.mkdirs ();
File outputFile = new File (fullDir, file... | Copy File | Type-3 (WT3/4) | true |
4,200,038 | public static int getCrc32asInt (byte [] in) {
if (in == null || in.length == 0) return - 1;
CRC32 crc = new CRC32 ();
crc.update (in);
return (int) crc.getValue ();
}
| 11,911,260 | private void readHeader () throws IOException {
CRC32 headCRC = new CRC32 ();
int magic = in.read ();
if (magic < 0) {
eos = true;
return;
}
headCRC.update (magic);
if (magic != (GZIP_MAGIC>> 8)) throw new IOException ("Error in GZIP header, first byte doesn't match");
magic... | CRC32 File Checksum | Type-3 (WT3/4) | false |
1,951,108 | private void zipStream (InputStream inStream, String streamName, File zipFile) throws IOException {
if (inStream == null) {
log.warn ("No stream to zip.");
} else {
try {
FileOutputStream dest = new FileOutputStream (zipFile);
ZipOutputStream out = new ZipOutputStream (ne... | 15,891,912 | public void close () {
logger.debug ("Closing output file.");
outfile.close ();
tempFile.renameTo (new File (fileName));
if (toZIP) {
logger.debug ("ZIPping output file.");
try {
ZipOutputStream zipout = new ZipOutputStream (new FileOutputStream (fileName + ".zip"));
... | Zip Files | Type-3 (WT3/4) | false |
1,751,009 | @BeforeClass
public static void createProblem () throws IOException, ParserConfigurationException, TransformerException {
problem = File.createTempFile ("___prb___", ".problem");
System.out.println ("created temporary problem " + problem);
ZipOutputStream zos = new ZipOutputStream (new FileOutputStream (pro... | 13,994,366 | public static boolean exportStandalone (String projectDirectory, String destinyJARPath) {
boolean exported = true;
try {
File destinyJarFile = new File (destinyJARPath);
FileOutputStream mergedFile = new FileOutputStream (destinyJarFile);
ZipOutputStream os = new ZipOutputStream (mergedF... | Zip Files | Type-3 (WT3/4) | false |
10,407,191 | @Override
public boolean copy (Document document, Folder folder) throws Exception {
boolean isCopied = false;
if (document.getId () != null && folder.getId () != null) {
Document copiedDoc = new DocumentModel ();
copiedDoc.setValues (document.getValues ());
copiedDoc.setFolder (folder);
... | 18,583,832 | private static void copy (File source, File target) throws IOException {
FileInputStream from = null;
FileOutputStream to = null;
try {
from = new FileInputStream (source);
to = new FileOutputStream (target);
byte [] buffer = new byte [4096];
int bytesRead;
while ((by... | Copy File | Type-3 (WT3/4) | true |
251,963 | File createJar (File jar, String...entries) throws IOException {
OutputStream out = new FileOutputStream (jar);
try {
JarOutputStream jos = new JarOutputStream (out);
for (String e : entries) {
jos.putNextEntry (new JarEntry (getPathForZipEntry (e)));
jos.write (getBodyFo... | 23,188,868 | public void run (IProgressMonitor runnerMonitor) throws CoreException {
try {
Map < String, File > projectFiles = new HashMap < String, File > ();
IPath basePath = new Path ("/");
for (File nextLocation : filesToZip) {
projectFiles.putAll (getFilesToZip (nextLocation, basePath, f... | Zip Files | Type-3 (WT3/4) | false |
3,230,278 | public static long getCRC (String content) {
if (content.length () == 0) return 0;
final java.util.zip.CRC32 crc = new java.util.zip.CRC32 ();
java.io.OutputStream crcOut = new java.io.OutputStream () {
@Override
public void write (int b) throws java.io.IOException {
crc.update ... | 23,677,203 | public static long checksum1 (File file) throws IOException {
CRC32 crc = new CRC32 ();
FileReader fr = new FileReader (file);
int data;
while ((data = fr.read ()) != - 1) {
crc.update (data);
}
fr.close ();
return crc.getValue ();
}
| CRC32 File Checksum | Type-3 (WT3/4) | false |
160,739 | public BufferedWriter createOutputStream (String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char [] buf = new char [k_blockSize];
File ofp = new File (outFile);
ZipOutputStream zos = new ZipOutputStream (new FileOutputStream (ofp));
zos.setMethod (ZipOutp... | 18,875,576 | public static < T extends ZipNode > void saveAll (OutputStream outputstream, Collection < T > list, ZipStreamFilter filter) throws Exception {
ZipOutputStream zip_out = new ZipOutputStream (outputstream);
try {
ZipEntry entry = new ZipEntry (".info/info.properties");
entry.setTime (0);
z... | Zip Files | Type-3 (WT3/4) | false |
1,936,137 | public void preparaEscrita (DadosSeriais dados, String dir) throws BasicException {
String idArquivo = dados.getIdColeta ().toString ();
if (dados.getIdResumo () != null) {
idArquivo += "_" + dados.getIdResumo ().toString ();
}
if (dir == null || dir.trim ().equals ("")) {
throw BasicExc... | 11,514,192 | private void zipDir (File dir, String jarEntry, JarOutputStream jos) throws IOException {
String [] dirList = dir.list ();
for (int i = 0;
i < dirList.length; i ++) {
File f = new File (dir, dirList [i]);
if (f.isDirectory ()) {
zipDir (f, jarEntry + dirList [i] + File.separatorC... | Zip Files | Type-3 (WT3/4) | false |
1,514,106 | private void exportLearningUnitView (File selectedFile) {
if (learningUnitViewElementsManager.isOriginalElementsOnly ()) {
String [] elementIds = learningUnitViewElementsManager.getAllLearningUnitViewElementIds ();
for (int i = 0;
i < elementIds.length; i ++) {
FSLLearningUnitVie... | 9,161,482 | public static void addToJar (JarOutputStream jos, JarFile jf) throws IOException {
Enumeration e = jf.entries ();
while (e.hasMoreElements ()) {
ZipEntry je = (ZipEntry) e.nextElement ();
InputStream io = jf.getInputStream (je);
byte b [] = new byte [4096];
int read = 0;
... | Zip Files | Type-3 (WT3/4) | false |
2,016,059 | private void ZipCode (NpsContext ctxt, ZipOutputStream out) throws Exception {
String filename = "JOB" + GetId () + ".data";
out.putNextEntry (new ZipEntry (filename));
try {
ZipWriter writer = new ZipWriter (out);
writer.print (code);
} finally {
out.closeEntry ();
}
}
| 8,703,701 | private byte [] injectModifiedText () {
byte [] buffer = new byte [BUFFER_SIZE];
boolean contentFound = false;
boolean stylesFound = false;
ByteArrayOutputStream out = new ByteArrayOutputStream (2 * fileData.length);
ZipOutputStream zipOutputStream = new ZipOutputStream (out);
ZipInputStream zip... | Zip Files | Type-3 (WT3/4) | false |
1,446,727 | private void backupDiskFile (ZipOutputStream out, String fileName, DiskFile file) throws SQLException, IOException {
Database db = session.getDatabase ();
fileName = FileUtils.getFileName (fileName);
out.putNextEntry (new ZipEntry (fileName));
int pos = - 1;
int max = file.getReadCount ();
while... | 18,195,007 | private void zipFiles () throws ZipException, IOException {
ZipOutputStream zipOuputStream = new ZipOutputStream (new FileOutputStream (zipFile));
for (File sourceDir : sourceDirs) {
File [] sourceFiles = sourceDir.listFiles (new SourceFileFilter ());
if (sourceFiles != null) {
for (... | Zip Files | Type-3 (WT3/4) | false |
2,096,403 | static void writeZipEntry (final byte [] data, final ZipOutputStream out, final ZipEntry entry, final boolean isCopy) throws IOException {
if (isCopy) {
out.putNextEntry (entry);
try {
out.write (data);
} finally {
out.closeEntry ();
}
} else {
fin... | 6,650,088 | public int calculateCRC () {
CRC32 crc = new CRC32 ();
crc.reset ();
crc.update (getData (), 2, getData ().length - 2);
return (short) (crc.getValue ());
}
| CRC32 File Checksum | Type-3 (WT3/4) | false |
1,177,247 | @Override
public void write (DataOutput dataOutput, byte [] object) throws IOException {
ZipOutputStream zos = new ZipOutputStream (new DataOutputOutputStream (dataOutput));
zos.setMethod (ZipOutputStream.DEFLATED);
zos.putNextEntry (new ZipEntry ("a"));
zos.write (object, 0, object.length);
zos.fin... | 15,468,308 | private void archiveDirectory (ZipOutputStream out, File dir, String path) throws IOException {
byte [] buf = new byte [16384];
File [] files = dir.listFiles ();
if (files.length > 0) {
for (int x = 0;
x < files.length; x ++) {
if (files [x].isFile ()) {
FileInput... | Zip Files | Type-3 (WT3/4) | true |
2,016,059 | private void ZipCode (NpsContext ctxt, ZipOutputStream out) throws Exception {
String filename = "JOB" + GetId () + ".data";
out.putNextEntry (new ZipEntry (filename));
try {
ZipWriter writer = new ZipWriter (out);
writer.print (code);
} finally {
out.closeEntry ();
}
}
| 3,720,682 | @Override
protected void doGet (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
ZipOutputStream zipout = new ZipOutputStream (resp.getOutputStream ());
ZipOutputStream zipout2 = new ZipOutputStream (new FileOutputStream (new File ("c:/t.zip")));
for (int i = 0;
i... | Zip Files | Type-3 (WT3/4) | false |
6,457,199 | protected boolean doRequest (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String path = request.getPathInfo ();
if (! path.startsWith (alias)) {
throw new ServletException ("Path '" + path + "' does not start with registered alias '" + alias + "'");
... | 16,227,459 | public CmsSetupTestResult execute (CmsSetupBean setupBean) {
CmsSetupTestResult testResult = new CmsSetupTestResult (this);
String basePath = setupBean.getWebAppRfsPath ();
if (! basePath.endsWith (File.separator)) {
basePath += File.separator;
}
File file1;
Random rnd = new Random ();
... | Copy File | Type-3 (WT3/4) | true |
1,446,726 | private void backupPageStore (ZipOutputStream out, String fileName, PageStore store) throws SQLException, IOException {
Database db = session.getDatabase ();
fileName = FileUtils.getFileName (fileName);
out.putNextEntry (new ZipEntry (fileName));
int max = store.getPageCount ();
int pos = 0;
whi... | 23,421,923 | void writeRawDataFile (RawDataFileImpl rawDataFile, int number) throws IOException, TransformerConfigurationException, SAXException {
numOfScans = rawDataFile.getNumOfScans ();
dataPointsOffsets = rawDataFile.getDataPointsOffsets ();
dataPointsLengths = rawDataFile.getDataPointsLengths ();
consolidatedD... | Zip Files | Type-3 (WT3/4) | false |
5,271,797 | private void loadMap () {
final String wordList = "vietwordlist.txt";
try {
File dataFile = new File (supportDir, wordList);
if (! dataFile.exists ()) {
final ReadableByteChannel input = Channels.newChannel (ClassLoader.getSystemResourceAsStream ("dict/" + dataFile.getName ()));
... | 10,478,671 | private void copyFile (File sourcefile, File targetfile) {
BufferedInputStream in = null;
BufferedOutputStream out = null;
try {
in = new BufferedInputStream (new FileInputStream (sourcefile));
out = new BufferedOutputStream (new FileOutputStream (targetfile));
byte [] buffer = new b... | Copy File | Type-3 (WT3/4) | true |
732,800 | public BufferedWriter createOutputStream (String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char [] buf = new char [k_blockSize];
File ofp = new File (outFile);
ZipOutputStream zos = new ZipOutputStream (new FileOutputStream (ofp));
zos.setMethod (ZipOutp... | 5,245,205 | private void writeDynData (final int time_s) throws IOException {
this.zos.putNextEntry (new ZipEntry ("step." + time_s + ".bin"));
this.outFile = new DataOutputStream (this.zos);
this.buf.position (0);
this.outFile.writeDouble (time_s);
this.quad.writeDynData (null, this.buf);
this.outFile.writ... | Zip Files | Type-3 (WT3/4) | false |
1,409,148 | public static int save () {
try {
String filename = "tyrant.sav";
FileDialog fd = new FileDialog (new Frame (), "Save Game", FileDialog.SAVE);
fd.setFile (filename);
fd.setVisible (true);
if (fd.getFile () != null) {
filename = fd.getDirectory () + fd.getFile ();
... | 14,203,228 | private void writeEntry (byte [] data, String name, ZipOutputStream outStream) throws IOException {
ZipEntry entry = new ZipEntry (name);
entry.setSize (data.length);
entry.setTime (System.currentTimeMillis ());
if (outStream != null) {
outStream.putNextEntry (entry);
outStream.write (da... | Zip Files | Type-3 (WT3/4) | false |
1,287,866 | private void cleanupStagingEnvironment (File stagingDir) throws FileUpdateException {
if (stagingDir != null && stagingDir.exists () && stagingDir.isDirectory ()) {
File [] files = stagingDir.listFiles ();
for (int i = 0;
i < files.length; i ++) {
File f = files [i];
... | 2,641,959 | public static boolean deleteDir (File dir) {
if (dir.exists ()) {
File [] files = dir.listFiles ();
for (int i = 0;
i < files.length; i ++) {
if (files [i].isDirectory ()) {
deleteDir (files [i]);
} else {
files [i].delete ();
... | Delete Folder and Contents | Type-3 (WT3/4) | false |
112,054 | private void exportAllSettings (HTTPurl urlData, OutputStream outStream) throws Exception {
CaptureDeviceList devList = CaptureDeviceList.getInstance ();
if (devList.getActiveDeviceCount () > 0) {
PageTemplate template = new PageTemplate (store.getProperty ("path.template") + File.separator + "SettingsL... | 21,830,091 | public void testImport () throws Exception {
Init.importEverything ();
String filename = Framework.onlyInstance ().getAppHomeDir () + "sts-sql/example.stz";
ZipOutputStream zo = new ZipOutputStream (new FileOutputStream (filename));
StringWriter swt;
byte [] data;
swt = new StringWriter ();
... | Zip Files | Type-3 (WT3/4) | true |
233,637 | public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletContext context = getServletContext ();
String forw = null;
try {
int maxUploadSize = 50000000;
MultipartRequest multi = new MultipartRequest (request, ".", maxUploadS... | 21,931,071 | public static void writeToPetrify (TransitionSystem ts, Writer bw) throws IOException {
File temp = new File ("_temp");
BufferedWriter tw = new BufferedWriter (new FileWriter (temp));
BufferedReader tr = new BufferedReader (new FileReader (temp));
HashSet < ModelGraphVertex > sources = new HashSet < Mod... | Copy File | Type-3 (WT3/4) | true |
2,049,240 | private void writeInfos () throws IOException {
zos.putNextEntry (new ZipEntry ("info.bin"));
outFile = new DataOutputStream (zos);
outFile.writeInt (VERSION);
outFile.writeInt (MINORVERSION);
outFile.writeDouble (intervall_s);
zos.closeEntry ();
}
| 20,339,695 | private void addToZip (String path, String srcFile, ZipOutputStream zip) {
File folder = new File (srcFile);
if (folder.isDirectory ()) {
this.addFolderToZip (path, srcFile, zip);
} else {
try {
boolean includeFile = false;
if (this.excludePattern == null) {
... | Zip Files | Type-3 (WT3/4) | false |
1,803,586 | private Service getServiceInstance (String className) {
try {
Class clazz = Class.forName (className);
return (Service) clazz.getConstructor (new Class [] {}).newInstance (new Object [] {});
} catch (ClassNotFoundException e) {
this.logger.error (className, e);
return null;
}... | 1,849,134 | private void setCommandInput () {
mCommandInput = null;
try {
Class < ? > consoleReaderClass = Class.forName ("jline.ConsoleReader");
if (consoleReaderClass != null) {
Class < ? > consoleInputClass = Class.forName ("jline.ConsoleReaderInputStream");
if (consoleInputClass ... | Instantiate Using Reflection | Type-3 (WT3/4) | true |
7,885,446 | public static String CreateZip (String [] filesToZip, String zipFileName) {
byte [] buffer = new byte [18024];
try {
ZipOutputStream out = new ZipOutputStream (new FileOutputStream (zipFileName));
out.setLevel (Deflater.BEST_COMPRESSION);
for (int i = 0;
i < filesToZip.length; i ... | 17,792,212 | private void createButtonCopyToClipboard () {
buttonCopyToClipboard = new Button (shell, SWT.PUSH);
buttonCopyToClipboard.setText ("Co&py to Clipboard");
buttonCopyToClipboard.setLayoutData (SharedStyle.relativeToBottomRight (buttonClose));
buttonCopyToClipboard.addSelectionListener (new SelectionAdapte... | Copy File | Type-3 (WT3/4) | true |
16,166,059 | public void transform (File inputMatrixFile, MatrixIO.Format inputFormat, File outputMatrixFile) throws IOException {
FileChannel original = new FileInputStream (inputMatrixFile).getChannel ();
FileChannel copy = new FileOutputStream (outputMatrixFile).getChannel ();
copy.transferFrom (original, 0, original... | 22,224,116 | public static void main (String [] args) throws IOException {
if (args.length == 0) {
System.out.println ("Usage: \nGZIPcompress file\n" + "\tUses GZIP compression to compress " + "the file to test.gz");
System.exit (1);
}
BufferedReader in = new BufferedReader (new FileReader (args [0]));
... | Copy File | Type-3 (WT3/4) | true |