Hi,
You could try the following, from
http://www.java-tips.org/java-se-tips/java.io/reading-a-file-into-a-byte-array.html
public static byte[] getBytesFromFile(File file) throws IOException {
InputStream is = new FileInputStream(file);
// Get the size of the file
long length = file.length();
if (length > Integer.MAX_VALUE) {
// File is too large
}
// Create the byte array to hold the data
byte[] bytes = new byte[(int)length];
// Read in the bytes
int offset = 0;
int numRead = 0;
while (offset < bytes.length
&& (numRead=is.read(bytes, offset, bytes.length-
offset)) >= 0) {
offset += numRead;
}
// Ensure all the bytes have been read in
if (offset < bytes.length) {
throw new IOException("Could not completely read file
"+file.getName());
}
// Close the input stream and return bytes
is.close();
return bytes;
}
-Julian
On Mar 26, 1:40 pm, Patty <[email protected]> wrote:
> Thanks Julian, I also have problems with the parameter byte[]
> photoData, not
> how to handle the photo.
> regards.
> Patty.
>
> On 26 mar, 06:29, "Julian (Google)" <[email protected]> wrote:
>
> > Hi,
>
> > We had a thread that could help
> > you:http://groups.google.com/group/google-contacts-api/browse_thread/thre...
>
> > Cheers,
> > Julian.
>
> > On Mar 25, 1:53 pm, Patty <[email protected]> wrote:
>
> > > there is a way to upload a photo to a contact with the api of contact
> > > for Google Apps?
> > > programing in .Net and JAVA
> > > Thanks!- Ocultar texto de la cita -
>
> > - Mostrar texto de la cita -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---