Is there any better and faster way to copy...
can anyone teel me any better and faster way to copy...
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(src);
out = new FileOutputStream(dest);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}catch(Exception e){
}
Here's a small program as a sample and for testing. Just ran a few tests with a file of 1.5 MB (buffered slightly faster) and a file of 45 MB (NIO much faster) ...
import java.io.*;
import java.nio.channels.*;
public class Copy {
public static void main(String[] args) {
if (args.length == 3) {
File from = new File(args[1]);
File to = new File(args[2]);
if (from.exists()) {
long start = System.currentTimeMillis();
try {
if (args[0].equals("nio")) {
copyNIO(from,to);
else {
copyBuffered(from,to);
catch (Exception ex) {
ex.printStackTrace();
System.out.println("Time: " + (System.currentTimeMillis() - start) + " ms");
private static void copyBuffered(File from,File to) throws IOException {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(from);
fos = new FileOutputStream(to);
BufferedInputStream in = new BufferedInputStream(fis);
BufferedOutputStream out = new BufferedOutputStream(fos);
byte[] buf = new byte[8192];
int r = 0;
while ((r = in.read(buf)) > 0) {
out.write(buf,0,r);
finally {
if (fis != null) {
try {
fis.close();
catch (Exception ex) {}
if (fos != null) {
try {
fos.close();
catch (Exception ex) {}
private static void copyNIO(File from,File to) throws IOException {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(from);
fos = new FileOutputStream(to);
FileChannel chin = fis.getChannel();
FileChannel chout = fos.getChannel();
long size = from.length();
long total = 0;
while (total < size) {
total += chin.transferTo(0,size,chout);
finally {
if (fis != null) {
try {
fis.close();
catch (Exception ex) {}
if (fos != null) {
try {
fos.close();
catch (Exception ex) {}
}
Similar Messages
-
How long does it take to update an original 3GS to 6.1.3? I followed the iTune instructions and it has been updating for hours already. Is there a better and faster way to do this?
SO if I want to represent the London Underground
network as a Graph how would I be able to do it?By writing classes of your own or using some one else's. I don't think that the collections framework has out-of-the-box support for graphs.... So try google first.
The implementation details depend on the API you are going to use, of course...
from A to B 5 min
from B to C 4 min
from A to C 9 min
this information is redundant, the third info should be omitted. <nit-picking>
No it's not - What if there's a special, more direct route from A to C? Also, getting from A to B to C will usually take more time than the time from A to B plus the time from B to C. The trains have to stop at B, don't they?
</nit-picking>
Maybe this approach is more complex, but it solves the problem Have I understood correctly - isn't what you describe just another way to implement a graph? -
Is there any quick and dirty way to determine what something will look like
Hi,
Is there any way (rule of thumb) to determine what something will look like when printed.
for example.
I am doing a composite (hope this is the right word). It will have some people sitting at a table and I want to have another layer with another picture behind it.
I plan for the output to be fairly small (print size), say 4 x 5 or whatever.
Now, if I go to the internet and google (or mamma.com) and search for images (large) and it comes back to me, I will see pictures that are (for example) 800 x 526 pixels 367 kb, or 940 x 480 pixels 166 kb.
I would have to assume the 367 kb will print at better resolution, but if i liked the 166 kb picture better, is there a quick and dirty way to determine if it would print better (say 250 or 300 dpi or whatever) or not?
So, bottome line,
Assume my output picture will be 4 x 5 (and I want 300dpi (or is it ppi)
How do quickly look at google results and determing if they will print ok?
BobThe closest to a one click fix in photoshop cs-cs5 is
Image>Adjustments>Shadow/Highlight or opening the
image through camera raw and using the recovery slider.
http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-765da.h tml
MTSTUNER -
What is the better and faster way to get the results
I'm looking for suggestion for my application.
I need to write an application where in certain section I need to do some checking for the SSN, I need to find if the SSN in table A is a duplicate in Table B.
Table B consist of more than 1 million SSN and table A may have a couple of thousands SSNs.
The SSN in table B consist of good and invalid SSN,such as, SSN with 000 on the first 3 digits or 00 on the second 2 digits or 0000 the the 4 last digits or even all 9 digits consist of 000 00 0000
If I do the regular select SSN from table B where SSN = 'SSN_from_table_A" for 3 to 5 thousands records in a cf loop than it may takes awhile before I can see the result.
Is there a better way to do this?alecken,
Can you explain some more about the workflow of your application. I'm not clear so to what is being returned to the client and what tasks are handled on the CF server, on the database server, and on the client's browser. Are you trying to return thousands or records to the client or having problems looping through thousands of records on the server. Is the client providing a single SSN to check or are you comparing all values in TableA to TableB? If possible could you post your CF and SQL code? -
Is there any better way for updating table other than this?
Hi all, I need to update a row in the table that require me to search for it first (the table will have more than hundred thousands of row). Now, I am using a LOV that will return the primary key of the row and put that primary key to DEFAULT_WHERE property in the block and execute query command to fetch the row that need updating. This works fine except that it require 2-query-trip per update (the lov and the execute_query). Is there any better way to doing this? This update is the main objective for my application and I need to use the most effective way to do it since we need to update many records per hour.
Thanks Rama, I will try your method. Others, how to query row instead of primary key? I thought that querying primary key is faster due to the index?
BTW, what people do if you need to update a table using Form? I have been using the LOV then execute query since I first developing form. But I am building a bigger database recently that I start worrying about multiple query trip to dbms.
FYI my table will have up to million rows on it. Each row will be very active (updated) within 1-2 weeks after it creation. After that it will exist for records purposes only (select only). The active rows are probably less than 1% of all the rows. -
How to find out whether my Iphone 3Gs (OS version 3.1.3) is officlially unlocked ( factory unlocked ) or "made" unlocked ? Can I upgrade its current OS 3.1.3 to OS 5 even if my phone is not officlially unlocked ? how to up grade its OS ? what are there any better ways to do it ?
Thanks,
PRANAJDepends wher you obtained the iPhone from and it's original supplier
If the iPhone is an authorised unlock ( approved by the carrier) or was
purchased from Apple as an unlocked iPhone updating the iOS
will have no effect on the iPhone and it's lock status
HOWEVER if the software has been tampered with to remove the lock,
updating the iOs will lock the iPhone back to the original carrier who holds the lock
To find out the status of your iPhone you could call Apple support
and they may tell you if the iPhone is locked or not and if it is which carrier -
Is there any better way to test an agent?
Every time when I changes some code in the agent, I have to restart the domain to load the new class file. I tried the reload the agent from the Oracle Enterprise Manager, but it is not working. The old agent is still going on. It gives me many troubles since I can't start the SMB server from Window 2000 terminal console. I have to go to the computer room to start SMB natively. Is there any better way to test an agent or start the SMB server in the Window 2000 terminal console?
Your help will be greatly appreciated!Jailcorder requires a jail broken iDevice to work. While it is not illegal to jail brake your iPhone in the US it is illegal to jail break an iPad.
If you do that you will not be able to use these board for help as the discussion of anything relating to a jail broken iDevice is against the TOU and the hosts will remove your posts
In addition looking tha Jailcorder it seems it has not kept up with Apple. It doesn;t work Xcode 5 and IOS 7.
On final thing to keep in mind a jail broken device behaves differently then one that is non jail broken. So even of you test with Jailcode you will still need to go through testing with a non jail broken device before submitting.
All in all if you are serious about developing for IOS it would seem the better course is to get the Developer account now.
regards -
Is there any command or other way which tells who and when replica got failover or failback to other replica?
RahulBy Monitoring of Availability Groups:
Monitoring of Availability Groups (SQL Server) -
Better and faster alternative for count(*)
I want to check whether empno=1234 exists in emp table
Currently I am using in proc
select count(*) into cnt from emp
where empno=1234
if cnt>1 then exists otherwise no exists.
Is there any better way to do the same.?user11253970 wrote:
I want to check whether empno=1234 exists in emp table
Is there any better way to do the same.?http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1525380674899
select count(*)
from dual
where exists ( select NULL
from emp
where sal = 5000 );Faster still is to not count at all
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1525380674899#34907832120350
Just process the data and take appropriate action if nothing was processed. -
How can I easily be sure I don't already have a magazine subscription or a single issue in Newsstand (or Zinio) when confronted with a purchase option. Is there an App or faster way to determine this information? Both Newsstand and Zenio have seen fit to "hide" this data deep in another App or menu, perhaps as a marketing tool to get you to buy multiple copies of the same magazine. I travel for a living and buy and delete digital magazine all the time. Sometimes, I buy them and am unable to download immediately due to slow WiFi or restrictions in airports, this adds to the confusion as what I have bought, deleted, or never downloaded, especially with multiple readers. Additionally, the App store manages current subscriptions on one menu and single purchases in another. I love reading on the new iPad, but the management of subscriptions has been an absolute nightmare. Is there another Newstand App that is easier to use or perhaps a Subscription Management App?
Take a look here:
http://support.apple.com/kb/HT4098
Other than looking in the various locations or doing a search for the title, I don't know of any way to easily find single-issue purchases.
Regards. -
step by step what's an easy and fast way to transfer photos and videos from my iphone to my imac?
Same as you would from any digital camera. Open iphoto, connect iphone, import photos
iOS: Importing personal photos and videos from iOS devices to your computer -
Are there any setting or some way to show notifications for new email without open Apple Mail app ?
You know , I am an OCD . I alway's close my Mail app and miss many important new emails .What I do is open the Mail.app, then click the red traffic light (upper left corner of the main Mail.app window) to close that window. The app itself will remain running and you will get updates - this helps keep the desktop tidy while while the mail app remains running. When an update is received, simply click the either the mail icon in your dock or go to the Mail.app menu and click Window > Message Viewer.
-
Which is better and faster in bootcamp xp or vista or 7
i have installed windows 7 by boot camp i have noticed its boot is very slow
i m thinking to remove it and try xp
anyway my question is which is better and faster xp or vista or 7? in bootcamp in the boot and in the normal use applications inside windows?sorry i meant i have istalled windows vista by bootcamp now i want to remove it i m asking which is faster and better xp or vista or 7 ?
-
I want to put my .m2ts movies (Sony HD recorder) on my Ipad3. It looks they need to be converted to h.264 format. Question is will Quicktime Pro work or are there any better software solutions. Running XP system. Thanks
You could try Handbrake, it works quite well.
-
Is there any rules and regulations to do SOA projects ?
Hi All,
1. Is there any rules and regulations to do SOA projects thro' XI?
2. Is it necessary to use BPM for SOA projects?
Regards
Sara
Points will be rewarded for the helpful answersHI,
See the below links
/people/kevin.liu/blog/2005/10/17/esa-soa-es
EAI:
http://en.wikipedia.org/wiki/Enterprise_Application_Integration
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e01bd5e9-1056-2910-00a6-cad748999126
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6d19c8ee-0c01-0010-619d-92af980436d7
SOA vs ESA
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e1a61c36-0301-0010-06be-d34e2f379a65
SOA - http://en.wikipedia.org/wiki/Service-oriented_architecture &
ESA - /people/kevin.liu/blog/2005/10/17/esa-soa-es
. Why SOA
/people/maxim.efimov2/blog/2006/08/22/the-roadmap-to-enterprise-soa-begins-with-150147-why148
SOA Foundations
/people/natty.gur/blog/2007/02/27/three-major-foundations-for-soa
2. SOA with SAP
/people/oleg.figlin/blog/2006/06/20/sap-discovery-system-for-enterprise-soa--part-1
/people/oleg.figlin/blog/2006/06/26/sap-discovery-system-for-enterprise-soa--part-2
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c1cb4b2c-0e01-0010-c99e-c272197d970f
3.XI and SOA
SAP XI in SOA
4. /people/community.user/blog/2007/01/30/enterprise-soa-explorations-fragments
/people/sindhu.gangadharan/blog/2006/06/19/it-scenario-enabling-enterprise-services-with-sap-netweaver
5. /people/abdulla.fawzi/blog/2007/01/03/enterprise-soa-based-innovations-and-its-benefits
EAI & EBI
EAI
EAI and EDI
Also see this document on this:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/13926f23-0a01-0010-149c-c1170e7a25db
Regards
Chilla
Maybe you are looking for
-
How can i actually REPORT a fault rather than be t...
Hi Folks, Ive got quite a poor line here, with a lot of noise, occassionally I can hear other conversations and its VERY faint most of the time - so much so I sometimes have to use redial with my mobile just to hear the other person. (Also to note my
-
How to add jsf trinidad or other jsf components to design palette
-
File archive part of CS6 is missing
I recently purchased and i'm trying to download and install. I receive this message "File archive part of CS6 is missing, you need all parts in the same folder. I have no idea
-
Wanting to know how to use itunes radio on my iphone
I'm inquiring as to how I can use the itunes radio on my iphone ?
-
You cannot copy inactive team members
Hi Gurus, when trying to assign a key member in oracle projects it is showing the Note As- You cannot copy inactive team members. I have checked the member in HRMS , He is in active assignment Please help me out from this issue ,Thanks in advance.