text string | label int64 |
|---|---|
[CLS] 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 =... | 0 |
[CLS] public static void fixEol(File fin) throws IOException {
File fout = File.createTempFile(fin.getName(), ".fixEol", fin.getParentFile());
FileChannel in = new FileInputStream(fin).getChannel();
if (0 != in.size()) {
FileChannel out = new FileOutputStream(fout).getChannel();
... | 1 |
[CLS] protected void doBackupOrganizeRelation() throws Exception {
Connection con = null;
PreparedStatement ps = null;
ResultSet result = null;
String strSelQuery = "SELECT organize_id,organize_type_id,child_id,child_type_id,remark " + "FROM " + Common.ORGANIZE_RELATION_TABLE;
St... | 0 |
[CLS] 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 = DcmObjectFact... | 1 |
[CLS] private void copyResource(String resource, File targetDir) {
InputStream is = FragmentFileSetTest.class.getResourceAsStream(resource);
Assume.assumeNotNull(is);
int i = resource.lastIndexOf("/");
String filename;
if (i == -1) {
filename = resource;
} els... | 1 |
[CLS] private void testConnection(String address) throws Exception {
URL url = new URL(address);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setUseCaches(false);
try {
con.connect();
assertEquals(HttpURLConnection.HTTP_OK, con.getResponse... | 0 |
[CLS] public static synchronized Font loadFont(String path, String fontName) {
Font f = null;
StringTokenizer tok = new StringTokenizer(path, ";");
NybbleInputStream str = null;
if (tok.hasMoreTokens()) tok.nextToken();
while (str == null && tok.hasMoreTokens()) {
try... | 0 |
[CLS] public boolean isPasswordCorrect(String attempt) {
try {
MessageDigest digest = MessageDigest.getInstance(attempt);
digest.update(salt);
digest.update(attempt.getBytes("UTF-8"));
byte[] attemptHash = digest.digest();
return attemptHash.equals(has... | 0 |
[CLS] 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));
... | 0 |
[CLS] private static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOEx... | 1 |
[CLS] protected EntailmentType invokeHttp(String stuff) {
String data = encode("theory") + "=" + encode(stuff);
URL url;
EntailmentType result = EntailmentType.unkown;
try {
url = new URL(httpAddress);
} catch (MalformedURLException e) {
throw new RuntimeE... | 0 |
[CLS] public void init(File file) {
InputStream is = null;
ByteArrayOutputStream os = null;
try {
is = new FileInputStream(file);
os = new ByteArrayOutputStream();
IOUtils.copy(is, os);
} catch (Throwable e) {
throw new VisualizerEngineExce... | 0 |
[CLS] private static String webService(String strUrl) {
StringBuffer buffer = new StringBuffer();
try {
URL url = new URL(strUrl);
InputStream input = url.openStream();
String sCurrentLine = "";
InputStreamReader read = new InputStreamReader(input, "utf-8"... | 0 |
[CLS] public void insertRealm(final List<NewRealms> newRealms) {
try {
connection.setAutoCommit(false);
new ProcessEnvelope().executeNull(new ExecuteProcessAbstractImpl(connection, false, false, true, true) {
@Override
public void executeProcessReturnNull... | 0 |
[CLS] public static void copyFile(File sourceFile, File targetFile) throws IOException {
FileInputStream iStream = new FileInputStream(sourceFile);
FileOutputStream oStream = new FileOutputStream(targetFile);
FileChannel inChannel = iStream.getChannel();
FileChannel outChannel = oStream.... | 1 |
[CLS] @Test
public void testCopy_inputStreamToWriter_Encoding_nullEncoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest o... | 0 |
[CLS] public static byte[] readFile(String filePath) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
FileInputStream is = new FileInputStream(filePath);
try {
IOUtils.copy(is, os);
return os.toByteArray();
} finally {
is.cl... | 1 |
[CLS] @Override
public void excluir(Disciplina t) throws Exception {
PreparedStatement stmt = null;
String sql = "DELETE from disciplina where id_disciplina = ?";
try {
stmt = conexao.prepareStatement(sql);
stmt.setInt(1, t.getIdDisciplina());
stmt.execute... | 0 |
[CLS] private static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOEx... | 0 |
[CLS] protected void refreshMods(String modsUrl) {
while (true) {
JMenuItem mi = mnMods.getItem(mnMods.getItemCount() - 1);
if (mi == null) break;
mnMods.remove(mnMods.getItemCount() - 1);
}
try {
log.info("Loading mods from " + modsUrl);
... | 0 |
[CLS] 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 =... | 1 |
[CLS] void serialize(ZipOutputStream out) throws IOException {
if ("imsmanifest.xml".equals(getFullName())) return;
out.putNextEntry(new ZipEntry(getFullName()));
IOUtils.copy(getDataStream(), out);
out.closeEntry();
} [SEP] public TestReport runImpl() throws Exception {
Docu... | 0 |
[CLS] 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... | 0 |
[CLS] public static byte[] SHA1(String... strings) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA1");
digest.reset();
for (String string : strings) {
digest.update(string.getBytes("UTF-8"));
}
return digest.digest();
... | 1 |
[CLS] public String getMD5(String data) {
try {
MessageDigest md5Algorithm = MessageDigest.getInstance("MD5");
md5Algorithm.update(data.getBytes(), 0, data.length());
byte[] digest = md5Algorithm.digest();
StringBuffer hexString = new StringBuffer();
S... | 1 |
[CLS] public void actionPerformed(ActionEvent e) {
if (path.compareTo("") != 0) {
imageName = (path.substring(path.lastIndexOf(File.separator) + 1, path.length()));
String name = imageName.substring(0, imageName.lastIndexOf('.'));
String extension = imageName.substring(imageN... | 1 |
[CLS] public static void main(String[] args) throws Exception {
if (args.length != 2) {
PrintUtil.prt("arguments: sourcefile, destfile");
System.exit(1);
}
FileChannel in = new FileInputStream(args[0]).getChannel(), out = new FileOutputStream(args[1]).getChannel();
... | 1 |
[CLS] private static boolean hasPackageInfo(URL url) {
if (url == null) return false;
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = br.readLine()) != null) {
if (li... | 0 |
[CLS] public static void joinFiles(FileValidator validator, File target, File[] sources) {
FileOutputStream fos = null;
try {
if (!validator.verifyFile(target)) return;
fos = new FileOutputStream(target);
FileInputStream fis = null;
byte[] bytes = new byte... | 1 |
[CLS] public InputStream retrieveStream(String url) {
HttpGet getRequest = new HttpGet(url);
try {
HttpResponse getResponse = client.execute(getRequest);
final int statusCode = getResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
... | 0 |
[CLS] public static String move_tags(String sessionid, String absolutePathForTheMovedTags, String absolutePathForTheDestinationTag) {
String resultJsonString = "some problem existed inside the create_new_tag() function if you see this string";
try {
Log.d("current running function name:", "m... | 0 |
[CLS] private void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceChan... | 0 |
[CLS] private String hash(String text) throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(text.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
return hash.toString(16);
} [SEP] public static String encrypt(String plainte... | 1 |
[CLS] private static void replaceEntityMappings(File signserverearpath, File entityMappingXML) throws ZipException, IOException {
ZipInputStream earFile = new ZipInputStream(new FileInputStream(signserverearpath));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ZipOutputStream tempZip... | 1 |
[CLS] public static File writeInternalFile(Context cx, URL url, String dir, String filename) {
FileOutputStream fos = null;
File fi = null;
try {
fi = newInternalFile(cx, dir, filename);
fos = FileUtils.openOutputStream(fi);
int length = IOUtils.copy(url.openS... | 1 |
[CLS] @Override
public void send(String payload, TransportReceiver receiver) {
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) url.openConnection();
configureConnection(connection);
OutputStream out = connection.getOutputStream();
... | 0 |
[CLS] public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;... | 1 |
[CLS] private void upgradeSchema() throws IOException {
Statement stmt = null;
try {
int i = getSchema();
if (i < SCHEMA_VERSION) {
conn.setAutoCommit(false);
stmt = conn.createStatement();
while (i < SCHEMA_VERSION) {
... | 0 |
[CLS] public void sortPlayersTurn() {
Token tempT = new Token();
Player tempP = new Player("test name", tempT);
int tempN = 0;
boolean exchangeMade = true;
for (int i = 0; i < playerNum - 1 && exchangeMade; i++) {
exchangeMade = false;
for (int j = 0; j < ... | 0 |
[CLS] @Override
public InputStream getResourceAsStream(String path) {
try {
URL url = this.getResource(path);
if (url == null) return null;
return url.openStream();
} catch (Exception e) {
log(e.getMessage(), e);
return null;
}
... | 0 |
[CLS] String openUrlAsString(String address, int maxLines) {
StringBuffer sb;
try {
URL url = new URL(address);
InputStream in = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
sb = new StringBuffer();
int c... | 0 |
[CLS] public static void copy(File toCopy, File dest) throws IOException {
FileInputStream src = new FileInputStream(toCopy);
FileOutputStream out = new FileOutputStream(dest);
try {
while (src.available() > 0) {
out.write(src.read());
}
} finally ... | 1 |
[CLS] @Override
public void call(String soapAction, SoapEnvelope envelope) throws IOException, XmlPullParserException {
if (soapAction == null) {
soapAction = "\"\"";
}
byte[] requestData = createRequestData(envelope);
requestDump = debug ? new String(requestData) : null;... | 0 |
[CLS] public List<Template> getTemplatesByKeywordsAndPage(String keywords, int page) {
String newKeywords = keywords;
if (keywords == null || keywords.trim().length() == 0) {
newKeywords = TemplateService.NO_KEYWORDS;
}
List<Template> templates = new ArrayList<Template>();
... | 0 |
[CLS] protected void load() throws IOException {
for (ClassLoader classLoader : classLoaders) {
Enumeration<URL> en = classLoader.getResources("META-INF/services/" + serviceClass.getName());
while (en.hasMoreElements()) {
URL url = en.nextElement();
InputS... | 1 |
[CLS] @SuppressWarnings("unchecked")
public ArrayList<GmailContact> getAllContacts() throws GmailException {
String query = properties.getString("export_page");
query = query.replace("[RANDOM_INT]", "" + random.nextInt());
int statusCode = -1;
GetMethod get = new GetMethod(query);
... | 0 |
[CLS] public static InputStream getInputStreamFromUrl(String url) {
InputStream content = null;
try {
HttpGet httpGet = new HttpGet(url);
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httpGet);
content = respon... | 0 |
[CLS] public void maj(String titre, String num_version) {
int res = 2;
String content_xml = "";
try {
URL url = new URL("http://code.google.com/feeds/p/tux-team/downloads/basic");
InputStreamReader ipsr = new InputStreamReader(url.openStream());
BufferedReader... | 0 |
[CLS] public static void writeDataResourceText(GenericValue dataResource, String mimeTypeId, Locale locale, Map templateContext, GenericDelegator delegator, Writer out, boolean cache) throws IOException, GeneralException {
Map context = (Map) templateContext.get("context");
if (context == null) {
... | 0 |
[CLS] public ProgramProfilingSymbol deleteProfilingSymbol(int id) throws AdaptationException {
ProgramProfilingSymbol profilingSymbol = null;
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
try {
String query = "SELECT * FROM Prog... | 0 |
[CLS] public boolean saveNote(NoteData n) {
String query;
try {
conn.setAutoCommit(false);
Statement stmt = null;
ResultSet rset = null;
stmt = conn.createStatement();
query = "select * from notes where noteid = " + n.getID();
rset ... | 1 |
[CLS] public void executeUpdate(Native nativeResource) throws Exception {
Connection con = null;
boolean autoCommit = true;
PreparedStatement st = null;
try {
HrRecord hr = getRepository();
ManagedConnection mc = returnConnection();
con = mc.getJdbcCon... | 0 |
[CLS] public void connect() throws IOException {
try {
URL url = new URL(pluginUrl);
connection = (HttpURLConnection) url.openConnection();
sendNotification(DownloadState.CONNECTION_ESTABLISHED);
contentLength = connection.getContentLength();
sendNotif... | 0 |
[CLS] public static org.osid.repository.AssetIterator search(Repository repository, SearchCriteria lSearchCriteria) throws org.osid.repository.RepositoryException {
try {
NodeList fieldNode = null;
if (lSearchCriteria.getSearchOperation() == SearchCriteria.FIND_OBJECTS) {
... | 0 |
[CLS] public void modify(ModifyInterceptorChain chain, DistinguishedName dn, ArrayList<LDAPModification> mods, LDAPConstraints constraints) throws LDAPException {
Connection con = (Connection) chain.getRequest().get(JdbcInsert.MYVD_DB_CON + this.dbInsertName);
if (con == null) {
throw new LD... | 0 |
[CLS] private static boolean verifyAppId(String appid) {
try {
String urlstr = "http://" + appid + ".appspot.com";
URL url = new URL(urlstr);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buf = new StringBuffer()... | 0 |
[CLS] public static Properties parse() {
try {
String userHome = System.getProperty("user.home");
File dsigFolder = new File(userHome, ".dsig");
if (!dsigFolder.exists() && !dsigFolder.mkdir()) {
throw new IOException("Could not create .dsig folder in user hom... | 0 |
[CLS] public static boolean doExecuteBatchSQL(List<String> sql) {
session = currentSession();
Connection conn = session.connection();
PreparedStatement ps = null;
try {
conn.setAutoCommit(false);
Iterator iter = sql.iterator();
while (iter.hasNext()) {... | 0 |
[CLS] public static FileChannel newFileChannel(File file, String rw, boolean enableException) throws IOException {
if (file == null) return null;
if (rw == null || rw.length() == 0) {
return null;
}
rw = rw.toLowerCase();
if (rw.equals(MODE_READ)) {
if (Fi... | 1 |
[CLS] @Test
public void testCopy_readerToOutputStream_Encoding_nullOut() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
Reader reader = new InputStreamReader(in, "US-ASCII");
try {
IOUtils.copy(reader, (Outpu... | 1 |
[CLS] public static void transfer(FileInputStream fileInStream, FileOutputStream fileOutStream) throws IOException {
FileChannel fileInChannel = fileInStream.getChannel();
FileChannel fileOutChannel = fileOutStream.getChannel();
long fileInSize = fileInChannel.size();
try {
l... | 1 |
[CLS] private void callbackWS(String xmlControl, String ws_results, long docId) {
SimpleProvider config;
Service service;
Object ret;
Call call;
Object[] parameter;
String method;
String wsurl;
URL url;
NodeList delegateNodes;
Node actualNo... | 0 |
[CLS] public void showGetStartedBox() {
String message = new String("Error: Resource Not Found.");
java.net.URL url = ClassLoader.getSystemResource("docs/get_started.html");
if (url != null) {
try {
StringBuffer buf = new StringBuffer();
BufferedReader... | 0 |
[CLS] byte[] calculateDigest(String value) {
try {
MessageDigest mg = MessageDigest.getInstance("SHA1");
mg.update(value.getBytes());
return mg.digest();
} catch (Exception e) {
throw Bark.unchecker(e);
}
} [SEP] private static void run(Display... | 0 |
[CLS] private void handleFile(File file, HttpServletRequest request, HttpServletResponse response) throws Exception {
String filename = file.getName();
long filesize = file.length();
String mimeType = getMimeType(filename);
response.setContentType(mimeType);
if (filesize > getDow... | 0 |
[CLS] public void connect() throws SocketException, IOException {
Log.i(TAG, "Test attempt login to " + ftpHostname + " as " + ftpUsername);
ftpClient = new FTPClient();
ftpClient.connect(this.ftpHostname, this.ftpPort);
ftpClient.login(ftpUsername, ftpPassword);
int reply = ftpC... | 0 |
[CLS] private void publishCMap(LWMap map) throws IOException {
try {
File savedCMap = PublishUtil.createIMSCP(Publisher.resourceVector);
InputStream istream = new BufferedInputStream(new FileInputStream(savedCMap));
OutputStream ostream = new BufferedOutputStream(new FileOutp... | 0 |
[CLS] public static boolean copyFile(final File fileFrom, final File fileTo) {
assert fileFrom != null : "fileFrom is null";
assert fileTo != null : "fileTo is null";
LOGGER.info(buildLogString(COPY_FILE_INFO, new Object[] { fileFrom, fileTo }));
boolean error = true;
FileInputSt... | 0 |
[CLS] private static String getSuitableWCSVersion(String host, String _version) throws ConnectException, IOException {
String request = WCSProtocolHandler.buildCapabilitiesSuitableVersionRequest(host, _version);
String version = new String();
StringReader reader = null;
DataInputStream d... | 0 |
[CLS] String getLatestVersion() {
try {
URL url = new URL(Constants.VERSION_FILE_URL);
URLConnection connection = url.openConnection();
connection.setConnectTimeout(15000);
InputStream in = connection.getInputStream();
BufferedReader br = new BufferedR... | 0 |
[CLS] public static List<String> getServers() throws Exception {
List<String> servers = new ArrayList<String>();
URL url = new URL("http://tfast.org/en/servers.php");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line = null;
while ((line... | 1 |
[CLS] public HttpURLConnection proxiedURLConnection(URL url, String serverName) throws IOException, PussycatException {
if (this.httpProxy == null || this.httpProxy.equals("") || PussycatUtils.isLocalURL(url.toString()) || url.toString().contains(serverName)) {
System.getProperties().put("proxySet",... | 0 |
[CLS] private Object[] retrieveSecondURL(URL url, RSLink link) {
link.setStatus(RSLink.STATUS_WAITING);
Object[] result = new Object[2];
HttpURLConnection httpConn = null;
BufferedReader inr = null;
DataOutputStream outs = null;
Pattern mirrorLinePattern = Pattern.compile... | 1 |
[CLS] @Test
public void testCopy_inputStreamToWriter_Encoding() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStreamTest(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStreamTest out = new Yell... | 1 |
[CLS] 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 =... | 0 |
[CLS] public static final String convertPassword(final String srcPwd) {
StringBuilder out;
MessageDigest md;
byte[] byteValues;
byte singleChar = 0;
try {
md = MessageDigest.getInstance("MD5");
md.update(srcPwd.getBytes());
byteValues = md.dige... | 1 |
[CLS] public static void writeFullImageToStream(Image scaledImage, String javaFormat, OutputStream os) throws IOException {
BufferedImage bufImage = new BufferedImage(scaledImage.getWidth(null), scaledImage.getHeight(null), BufferedImage.TYPE_BYTE_BINARY);
Graphics gr = bufImage.getGraphics();
g... | 1 |
[CLS] @Override
public void writeTo(final TrackRepresentation t, final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws WebApplicationException {
if (mediaType.isCompati... | 1 |
[CLS] public static String generateHash(final String sText, final String sAlgo) throws NoSuchAlgorithmException {
final MessageDigest md = MessageDigest.getInstance(sAlgo);
md.update(sText.getBytes());
final Formatter formatter = new Formatter();
for (final Byte curByte : md.digest()) fo... | 1 |
[CLS] @SuppressWarnings("unchecked")
protected void displayFreeMarkerResponse(HttpServletRequest request, HttpServletResponse response, String templateName, Map<String, Object> variableMap) throws IOException {
Enumeration<String> attrNameEnum = request.getSession().getAttributeNames();
String attrN... | 1 |
[CLS] public String readURL(URL url) throws JasenException {
OutputStream out = new ByteArrayOutputStream();
InputStream in = null;
String html = null;
NonBlockingStreamReader reader = null;
try {
in = url.openStream();
reader = new NonBlockingStreamReader... | 0 |
[CLS] public static String getHtml(DefaultHttpClient httpclient, String url, String encode) throws IOException {
InputStream input = null;
HttpGet get = new HttpGet(url);
HttpResponse res = httpclient.execute(get);
StatusLine status = res.getStatusLine();
if (status.getStatusCode... | 1 |
[CLS] public synchronized void checkout() throws SQLException, InterruptedException {
Connection con = this.session.open();
con.setAutoCommit(false);
String sql_stmt = DB2SQLStatements.shopping_cart_getAll(this.customer_id);
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSE... | 0 |
[CLS] public static void copyFile(File src, File dest, boolean force) throws IOException {
if (dest.exists()) {
if (force) {
dest.delete();
} else {
throw new IOException("Cannot overwrite existing file: " + dest);
}
}
byte[] bu... | 1 |
[CLS] public static void copy(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf = ... | 1 |
[CLS] public String getHtmlCodeUnCharset(String urlString) {
StringBuffer result = new StringBuffer();
BufferedReader in = null;
try {
URL url = new URL((urlString));
URLConnection con = url.openConnection();
in = new BufferedReader(new InputStreamReader(con.g... | 0 |
[CLS] public static boolean decodeFileToFile(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)), Base6... | 1 |
[CLS] private static void copierScriptChargement(File webInfDir, String initialDataChoice) {
File chargementInitialDir = new File(webInfDir, "chargementInitial");
File fichierChargement = new File(chargementInitialDir, "ScriptChargementInitial.sql");
File fichierChargementAll = new File(chargeme... | 0 |
[CLS] private void handleUpload(CommonsMultipartFile file, String newFileName, String uploadDir) throws IOException, FileNotFoundException {
File dirPath = new File(uploadDir);
if (!dirPath.exists()) {
dirPath.mkdirs();
}
InputStream stream = file.getInputStream();
Ou... | 1 |
[CLS] private String sendMessage(HttpURLConnection connection, String reqMessage) throws IOException {
if (msgLog.isTraceEnabled()) msgLog.trace("Outgoing SOAPMessage\n" + reqMessage);
BufferedOutputStream out = new BufferedOutputStream(connection.getOutputStream());
out.write(reqMessage.getByte... | 1 |
[CLS] public void testScenario() throws Exception {
String expression = "SELECT id, name, address, phone FROM " + TABLE + " where id > 2 and id < 12 order by id";
SQLQuery query = new SQLQuery();
query.setResourceID(mResourceID);
query.addExpression(expression);
TupleToWebRowSetC... | 0 |
[CLS] private Set read() throws IOException {
URL url = new URL(urlPrefix + channelId + ".dat");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line = in.readLine();
Set programs = new HashSet();
while (line != null) {
String[]... | 0 |
[CLS] public static String md5Encode16(String s) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(s.getBytes("utf-8"));
byte b[] = md.digest();
int i;
StringBuilder buf = new StringBuilder("");
for (int offset = 0; off... | 0 |
[CLS] private void connectAndLogin() throws SocketException, IOException, ClassNotFoundException, SQLException, FileNotFoundException {
lastOperationTime = System.currentTimeMillis();
exit();
ftp = new FTPClient();
ftp.connect(SERVER);
ftp.login(USERNAME, PASSWORD);
ftp.e... | 0 |
[CLS] public static void concatFiles(final String as_base_file_name) throws IOException, FileNotFoundException {
new File(as_base_file_name).createNewFile();
final OutputStream lo_out = new FileOutputStream(as_base_file_name, true);
int ln_part = 1, ln_readed = -1;
final byte[] lh_buffer... | 1 |
[CLS] public static String encryptPassword(String password) {
if (password == null) return null;
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
log.error("Algorithm not found", e);
... | 0 |
[CLS] @Override
public void doExecute(String[] args) {
if (args.length != 2) {
printUsage();
} else {
int fileNo = 0;
try {
fileNo = Integer.parseInt(args[1]) - 1;
} catch (NumberFormatException e) {
printUsage();
... | 1 |
[CLS] public static byte[] SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest()... | 0 |
[CLS] public static void copy(File in, File out) throws IOException {
FileChannel ic = new FileInputStream(in).getChannel();
FileChannel oc = new FileOutputStream(out).getChannel();
ic.transferTo(0, ic.size(), oc);
ic.close();
oc.close();
} [SEP] public int deleteFile(Integer... | 0 |
[CLS] private void createProperty(String objectID, String value, String propertyID, Long userID) throws JspTagException {
ClassProperty classProperty = new ClassProperty(new Long(propertyID));
String newValue = value;
if (classProperty.getName().equals("Password")) {
try {
... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.